primereact 10.6.5 → 10.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/api/api.d.ts +8 -0
- package/chart/chart.d.ts +1 -13
- package/column/column.d.ts +6 -0
- package/core/core.js +94 -30
- package/core/core.min.js +8 -8
- package/datatable/datatable.cjs.js +56 -46
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.esm.js +56 -46
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +56 -46
- package/datatable/datatable.min.js +1 -1
- package/dialog/dialog.cjs.js +5 -3
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.esm.js +5 -3
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +5 -3
- package/dialog/dialog.min.js +1 -1
- package/dropdown/dropdown.cjs.js +3 -3
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +3 -3
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +3 -3
- package/dropdown/dropdown.min.js +1 -1
- package/galleria/galleria.cjs.js +7 -0
- package/galleria/galleria.cjs.min.js +1 -1
- package/galleria/galleria.esm.js +8 -1
- package/galleria/galleria.esm.min.js +1 -1
- package/galleria/galleria.js +7 -0
- package/galleria/galleria.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +14 -11
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +14 -11
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +14 -11
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputotp/inputotp.cjs.js +25 -1
- package/inputotp/inputotp.cjs.min.js +1 -1
- package/inputotp/inputotp.esm.js +26 -2
- package/inputotp/inputotp.esm.min.js +1 -1
- package/inputotp/inputotp.js +25 -1
- package/inputotp/inputotp.min.js +1 -1
- package/keyfilter/keyfilter.cjs.js +1 -1
- package/keyfilter/keyfilter.cjs.min.js +1 -1
- package/keyfilter/keyfilter.esm.js +1 -1
- package/keyfilter/keyfilter.esm.min.js +1 -1
- package/keyfilter/keyfilter.js +1 -1
- package/keyfilter/keyfilter.min.js +1 -1
- package/metergroup/metergroup.cjs.js +2 -1
- package/metergroup/metergroup.cjs.min.js +1 -1
- package/metergroup/metergroup.esm.js +2 -1
- package/metergroup/metergroup.esm.min.js +1 -1
- package/metergroup/metergroup.js +2 -1
- package/metergroup/metergroup.min.js +1 -1
- package/multiselect/multiselect.cjs.js +2 -2
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.esm.js +2 -2
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +2 -2
- package/multiselect/multiselect.min.js +1 -1
- package/package.json +1 -1
- package/paginator/paginator.cjs.js +1 -1
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.esm.js +1 -1
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +1 -1
- package/paginator/paginator.min.js +1 -1
- package/panelmenu/panelmenu.cjs.js +13 -12
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +13 -12
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +13 -12
- package/panelmenu/panelmenu.min.js +1 -1
- package/password/password.cjs.js +2 -2
- package/password/password.cjs.min.js +1 -1
- package/password/password.esm.js +2 -2
- package/password/password.esm.min.js +1 -1
- package/password/password.js +2 -2
- package/password/password.min.js +1 -1
- package/primereact.all.cjs.js +2859 -1916
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +2856 -1917
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +2859 -1916
- package/primereact.all.min.js +1 -1
- package/resources/themes/arya-blue/theme.css +62 -0
- package/resources/themes/arya-green/theme.css +62 -0
- package/resources/themes/arya-orange/theme.css +62 -0
- package/resources/themes/bootstrap4-dark-blue/theme.css +62 -0
- package/resources/themes/bootstrap4-dark-purple/theme.css +207 -43
- package/resources/themes/bootstrap4-light-blue/theme.css +62 -0
- package/resources/themes/bootstrap4-light-purple/theme.css +207 -43
- package/resources/themes/fluent-light/theme.css +62 -0
- package/resources/themes/lara-dark-amber/theme.css +62 -9
- package/resources/themes/lara-dark-blue/theme.css +62 -9
- package/resources/themes/lara-dark-cyan/theme.css +62 -9
- package/resources/themes/lara-dark-green/theme.css +62 -9
- package/resources/themes/lara-dark-indigo/theme.css +62 -9
- package/resources/themes/lara-dark-pink/theme.css +62 -9
- package/resources/themes/lara-dark-teal/theme.css +62 -9
- package/resources/themes/lara-light-amber/theme.css +62 -9
- package/resources/themes/lara-light-blue/theme.css +62 -9
- package/resources/themes/lara-light-cyan/theme.css +62 -9
- package/resources/themes/lara-light-green/theme.css +62 -9
- package/resources/themes/lara-light-indigo/theme.css +62 -9
- package/resources/themes/lara-light-pink/theme.css +62 -9
- package/resources/themes/lara-light-teal/theme.css +62 -9
- package/resources/themes/luna-amber/theme.css +62 -0
- package/resources/themes/luna-blue/theme.css +62 -0
- package/resources/themes/luna-green/theme.css +62 -0
- package/resources/themes/luna-pink/theme.css +62 -0
- package/resources/themes/md-dark-deeppurple/theme.css +225 -43
- package/resources/themes/md-dark-indigo/theme.css +213 -151
- package/resources/themes/md-light-deeppurple/theme.css +225 -43
- package/resources/themes/md-light-indigo/theme.css +62 -0
- package/resources/themes/mdc-dark-deeppurple/theme.css +225 -43
- package/resources/themes/mdc-dark-indigo/theme.css +213 -151
- package/resources/themes/mdc-light-deeppurple/theme.css +225 -43
- package/resources/themes/mdc-light-indigo/theme.css +62 -0
- package/resources/themes/mira/theme.css +62 -0
- package/resources/themes/nano/theme.css +62 -0
- package/resources/themes/nova/theme.css +62 -0
- package/resources/themes/nova-accent/theme.css +62 -0
- package/resources/themes/nova-alt/theme.css +62 -0
- package/resources/themes/rhea/theme.css +62 -0
- package/resources/themes/saga-blue/theme.css +62 -0
- package/resources/themes/saga-green/theme.css +62 -0
- package/resources/themes/saga-orange/theme.css +62 -0
- package/resources/themes/soho-dark/theme.css +87 -25
- package/resources/themes/soho-light/theme.css +62 -0
- package/resources/themes/tailwind-light/theme.css +62 -0
- package/resources/themes/vela-blue/theme.css +62 -0
- package/resources/themes/vela-green/theme.css +62 -0
- package/resources/themes/vela-orange/theme.css +62 -0
- package/resources/themes/viva-dark/theme.css +62 -0
- package/resources/themes/viva-light/theme.css +62 -0
- package/tabview/tabview.cjs.js +0 -2
- package/tabview/tabview.cjs.min.js +1 -1
- package/tabview/tabview.esm.js +0 -2
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +0 -2
- package/tabview/tabview.min.js +1 -1
- package/tooltip/tooltip.cjs.js +2 -2
- package/tooltip/tooltip.cjs.min.js +1 -1
- package/tooltip/tooltip.esm.js +2 -2
- package/tooltip/tooltip.esm.min.js +1 -1
- package/tooltip/tooltip.js +2 -2
- package/tooltip/tooltip.min.js +1 -1
- package/tree/tree.cjs.js +45 -8
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +45 -8
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +45 -8
- package/tree/tree.min.js +1 -1
- package/treetable/treetable.cjs.js +240 -7
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.d.ts +29 -0
- package/treetable/treetable.esm.js +240 -7
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +240 -7
- package/treetable/treetable.min.js +1 -1
- package/utils/utils.d.ts +7 -4
- package/virtualscroller/virtualscroller.cjs.js +23 -1
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.esm.js +23 -1
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +23 -1
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +66 -28
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),n=require("primereact/componentbase"),r=require("primereact/hooks"),o=require("primereact/icons/chevrondown"),l=require("primereact/icons/spinner"),i=require("primereact/icons/times"),a=require("primereact/overlayservice"),u=require("primereact/tooltip"),c=require("primereact/utils"),s=require("primereact/csstransition"),p=require("primereact/icons/search"),d=require("primereact/portal"),f=require("primereact/virtualscroller"),m=require("primereact/ripple"),v=require("primereact/icons/check"),b=require("primereact/iconbase");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function h(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var y=h(e),w=g(t);function O(){return O=Object.assign?Object.assign.bind():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},O.apply(this,arguments)}function I(e){return I="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},I(e)}function E(e,t){if("object"!==I(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function x(e){var t=E(e,"string");return"symbol"===I(t)?t:String(t)}function S(e,t,n){return(t=x(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e){if(Array.isArray(e))return e}function j(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,l,i,a=[],u=!0,c=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=l.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return a}}function F(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 N(e,t){if(e){if("string"==typeof e)return F(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)?F(e,t):void 0}}function C(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function k(e,t){return D(e)||j(e,t)||N(e,t)||C()}var L=n.ComponentBase.extend({defaultProps:{__TYPE:"Dropdown",__parentMetadata:null,appendTo:null,ariaLabel:null,ariaLabelledBy:null,autoFocus:!1,children:void 0,className:null,clearIcon:null,dataKey:null,disabled:!1,dropdownIcon:null,editable:!1,emptyFilterMessage:null,highlightOnSelect:!0,checkmark:!1,emptyMessage:null,filter:!1,filterBy:null,filterClearIcon:null,filterIcon:null,filterInputAutoFocus:!1,filterLocale:void 0,filterMatchMode:"contains",filterPlaceholder:null,filterTemplate:null,focusInputRef:null,id:null,inputId:null,inputRef:null,invalid:!1,variant:null,itemTemplate:null,loading:!1,loadingIcon:null,maxLength:null,name:null,onBlur:null,onChange:null,onContextMenu:null,onFilter:null,onFocus:null,onHide:null,onMouseDown:null,onShow:null,optionDisabled:null,optionGroupChildren:"items",selectOnFocus:!1,focusOnHover:!0,autoOptionFocus:!1,optionGroupLabel:null,optionGroupTemplate:null,optionLabel:null,optionValue:null,options:null,panelClassName:null,panelFooterTemplate:null,panelStyle:null,placeholder:null,required:!1,resetFilterOnHide:!1,scrollHeight:"200px",showClear:!1,showFilterClear:!1,showOnFocus:!1,style:null,tabIndex:null,tooltip:null,tooltipOptions:null,transitionOptions:null,value:null,valueTemplate:null,virtualScrollerOptions:null},css:{classes:{root:function(e){var t=e.props,n=e.focusedState,r=e.overlayVisibleState,o=e.context;return c.classNames("p-dropdown p-component p-inputwrapper",{"p-disabled":t.disabled,"p-invalid":t.invalid,"p-focus":n,"p-variant-filled":t.variant?"filled"===t.variant:o&&"filled"===o.inputStyle,"p-dropdown-clearable":t.showClear&&!t.disabled,"p-inputwrapper-filled":c.ObjectUtils.isNotEmpty(t.value),"p-inputwrapper-focus":n||r})},input:function(e){var t=e.props,n=e.label;return t.editable?"p-dropdown-label p-inputtext":c.classNames("p-dropdown-label p-inputtext",{"p-placeholder":null===n&&t.placeholder,"p-dropdown-label-empty":null===n&&!t.placeholder})},trigger:"p-dropdown-trigger",emptyMessage:"p-dropdown-empty-message",itemGroup:function(e){var t=e.optionGroupLabel;return c.classNames("p-dropdown-item-group",{"p-dropdown-item-empty":!t||0===t.length})},itemGroupLabel:"p-dropdown-item-group-label",dropdownIcon:"p-dropdown-trigger-icon p-clickable",loadingIcon:"p-dropdown-trigger-icon p-clickable",clearIcon:"p-dropdown-clear-icon p-clickable",filterIcon:"p-dropdown-filter-icon",filterClearIcon:"p-dropdown-filter-clear-icon",filterContainer:function(e){return c.classNames("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!e.clearIcon})},filterInput:function(e){var t=e.props,n=e.context;return c.classNames("p-dropdown-filter p-inputtext p-component",{"p-variant-filled":t.variant?"filled"===t.variant:n&&"filled"===n.inputStyle})},list:function(e){return"p-dropdown-items"},panel:function(e){var t=e.context;return c.classNames("p-dropdown-panel p-component",{"p-input-filled":t&&"filled"===t.inputStyle||"filled"===w.default.inputStyle,"p-ripple-disabled":t&&!1===t.ripple||!1===w.default.ripple})},item:function(e){var t=e.label;return c.classNames("p-dropdown-item",{"p-highlight":e.selected&&e.highlightOnSelect,"p-disabled":e.disabled,"p-focus":e.index===e.focusedOptionIndex,"p-dropdown-item-empty":!t||0===t.length})},itemLabel:"p-dropdown-item-label",checkIcon:"p-dropdown-check-icon",blankIcon:"p-dropdown-blank-icon",wrapper:"p-dropdown-items-wrapper",header:"p-dropdown-header",footer:"p-dropdown-footer",transition:"p-connected-overlay"},styles:"\n@layer primereact {\n .p-dropdown {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n }\n \n .p-dropdown-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n \n .p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n \n .p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n }\n \n input.p-dropdown-label {\n cursor: default;\n }\n \n .p-dropdown .p-dropdown-panel {\n min-width: 100%;\n }\n \n .p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n }\n \n .p-dropdown-items-wrapper {\n overflow: auto;\n }\n \n .p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n }\n \n .p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n \n .p-dropdown-filter {\n width: 100%;\n }\n \n .p-dropdown-filter-container {\n position: relative;\n }\n \n .p-dropdown-clear-icon,\n .p-dropdown-filter-icon,\n .p-dropdown-filter-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-fluid .p-dropdown {\n display: flex;\n }\n \n .p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n }\n}\n",inlineStyles:{wrapper:function(e){return{maxHeight:e.props.scrollHeight||"auto"}},panel:function(e){}}}}),P=y.memo(y.forwardRef((function(e,t){var n=b.IconBase.getPTI(e);return y.createElement("svg",O({ref:t,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),y.createElement("rect",{width:"1",height:"1",fill:"currentColor",fillOpacity:"0"}))})));P.displayName="BlankIcon";var U=y.memo((function(e){var t=r.useMergeProps(),n=e.ptm,o=e.cx,l=e.selected,i=e.disabled,a=e.option,u=e.label,s=e.index,p=e.focusedOptionIndex,d=e.checkmark,f=e.highlightOnSelect,b=function(e){return n(e,{context:{selected:l,disabled:i}})},g=e.template?c.ObjectUtils.getJSXElement(e.template,e.option):e.label,h=t({role:"option",key:e.label,className:c.classNames(a.className,o("item",{selected:l,disabled:i,label:u,index:s,focusedOptionIndex:p,highlightOnSelect:f})),style:e.style,onClick:function(t){return n=t,void(e.onClick&&e.onClick({originalEvent:n,option:a}));var n},onMouseMove:function(t){return null==e?void 0:e.onMouseMove(t,s)},"aria-label":u,"aria-selected":l,"data-p-highlight":l,"data-p-focused":p===s,"data-p-disabled":i},b("item")),w=t({className:o("itemLabel")},b("itemLabel"));return y.createElement("li",h,d&&function(){if(l){var e=t({className:o("checkIcon")},b("checIcon"));return y.createElement(v.CheckIcon,e)}var n=t({className:o("blankIcon")},b("blankIcon"));return y.createElement(P,n)}(),y.createElement("span",w,g),y.createElement(m.Ripple,null))}));function R(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 T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}U.displayName="DropdownItem";var M=y.memo(y.forwardRef((function(e,n){var o,l,a,u,m,v=r.useMergeProps(),b=e.ptm,g=e.cx,h=e.sx,w=y.useContext(t.PrimeReactContext),I=y.useRef(null),E=!(e.visibleOptions&&e.visibleOptions.length)&&e.hasFilter,x={filter:function(e){return F(e)},reset:function(){return e.resetFilter()}},S=function(t,n){return b(t,T({hostName:e.hostName},n))},D=function(){e.onEnter((function(){if(e.virtualScrollerRef.current){var t=e.getSelectedOptionIndex();-1!==t&&setTimeout((function(){return e.virtualScrollerRef.current.scrollToIndex(t)}),0)}}))},j=function(){e.onEntered((function(){e.filter&&e.filterInputAutoFocus&&c.DomHandler.focus(I.current,!1)}))},F=function(t){e.virtualScrollerRef.current&&e.virtualScrollerRef.current.scrollToIndex(0),e.onFilterInputChange&&e.onFilterInputChange(t)},N=function(){if(e.panelFooterTemplate){var t=c.ObjectUtils.getJSXElement(e.panelFooterTemplate,e,e.onOverlayHide),n=v({className:g("footer")},S("footer"));return y.createElement("div",n,t)}return null},C=function(t,n){var r;e.focusOnHover&&(null==e||null===(r=e.changeFocusedOptionIndex)||void 0===r||r.call(e,t,n))},k=function(n,r){var o=c.ObjectUtils.getJSXElement(n,e)||t.localeOption(r?"emptyFilterMessage":"emptyMessage"),l=v({className:g("emptyMessage")},S("emptyMessage"));return y.createElement("li",l,o)},L=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o={height:r.props?r.props.itemSize:void 0};if(o=T(T({},o),t.style),t.group&&e.optionGroupLabel){var l=e.optionGroupLabel,i=e.optionGroupTemplate?c.ObjectUtils.getJSXElement(e.optionGroupTemplate,t,n):e.getOptionGroupLabel(t),a=n+"_"+e.getOptionGroupRenderKey(t),u=v({className:g("itemGroup",{optionGroupLabel:l}),style:o,"data-p-highlight":e.selected},S("itemGroup")),s=v({className:g("itemGroupLabel")},S("itemGroupLabel"));return y.createElement("li",O({key:a},u),y.createElement("span",s,i))}var p=e.getOptionRenderKey(t)+"_"+n,d=e.getOptionLabel(t),f=e.isOptionDisabled(t);return y.createElement(U,{key:p,label:d,index:n,focusedOptionIndex:e.focusedOptionIndex,option:t,style:o,template:e.itemTemplate,selected:e.isSelected(t),highlightOnSelect:e.highlightOnSelect,disabled:f,onClick:e.onOptionClick,onMouseMove:C,ptm:b,cx:g,checkmark:e.checkmark})},P=function(){if(e.showFilterClear&&e.filterValue){var n=t.localeOption("clear"),r=v({className:g("filterClearIcon"),"aria-label":n,onClick:function(){return e.onFilterClearIconClick((function(){return c.DomHandler.focus(I.current)}))}},S("filterClearIcon"));return c.IconUtils.getJSXIcon(e.filterClearIcon||y.createElement(i.TimesIcon,r),T({},r),{props:e})}return null},R=function(){if(e.filter){var t=P(),n=v({className:g("filterIcon")},S("filterIcon")),r=c.IconUtils.getJSXIcon(e.filterIcon||y.createElement(p.SearchIcon,n),T({},n),{props:e}),o=v({className:g("filterContainer",{clearIcon:t})},S("filterContainer")),l=v({ref:I,type:"text",autoComplete:"off",className:g("filterInput",{context:w}),placeholder:e.filterPlaceholder,onKeyDown:e.onFilterInputKeyDown,onChange:function(e){return F(e)},value:e.filterValue},S("filterInput")),i=y.createElement("div",o,y.createElement("input",l),t,r);if(e.filterTemplate){var a={className:c.classNames("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!t}),element:i,filterOptions:x,filterInputKeyDown:e.onFilterInputKeyDown,filterInputChange:F,filterIconClassName:"p-dropdown-filter-icon",clearIcon:t,props:e};i=c.ObjectUtils.getJSXElement(e.filterTemplate,a)}var u=v({className:g("header")},S("header"));return y.createElement("div",u,i)}return null},M=function(){if(e.virtualScrollerOptions){var t=T(T({},e.virtualScrollerOptions),{style:T(T({},e.virtualScrollerOptions.style),{height:e.scrollHeight}),className:c.classNames("p-dropdown-items-wrapper",e.virtualScrollerOptions.className),items:e.visibleOptions,autoSize:!0,onLazyLoad:function(t){return e.virtualScrollerOptions.onLazyLoad(T(T({},t),{filter:e.filterValue}))},itemTemplate:function(e,t){return e&&L(e,t.index,t)},contentTemplate:function(t){var n=E?k(e.hasFilter?e.emptyFilterMessage:e.emptyMessage):t.children,r=v({ref:t.contentRef,style:t.style,className:c.classNames(t.className,g("list",{virtualScrollerProps:e.virtualScrollerOptions})),role:"listbox"},S("list"));return y.createElement("ul",r,n)}});return y.createElement(f.VirtualScroller,O({ref:e.virtualScrollerRef},t,{pt:b("virtualScroller")}))}var n=c.ObjectUtils.isNotEmpty(e.visibleOptions)?e.visibleOptions.map(L):e.hasFilter?k(e.emptyFilterMessage,!0):k(e.emptyMessage),r=v({className:g("wrapper"),style:h("wrapper")},S("wrapper")),o=v({className:g("list"),role:"listbox"},S("list"));return y.createElement("div",r,y.createElement("ul",o,n))},H=(o=R(),l=M(),a=N(),u=v({className:c.classNames(e.panelClassName,g("panel",{context:w})),style:h("panel"),onClick:e.onClick},S("panel")),m=v({classNames:g("transition"),in:e.in,timeout:{enter:120,exit:100},options:e.transitionOptions,unmountOnExit:!0,onEnter:D,onEntered:j,onExit:e.onExit,onExited:e.onExited},S("transition")),y.createElement(s.CSSTransition,O({nodeRef:n},m),y.createElement("div",O({ref:n},u),e.firstFocusableElement,o,l,a,e.lastFocusableElement)));return y.createElement(d.Portal,{element:H,appendTo:e.appendTo})})));function H(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=G(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 l,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,l=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw l}}}}function G(e,t){if(e){if("string"==typeof e)return A(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)?A(e,t):void 0}}function A(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 q(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 V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}M.displayName="DropdownPanel";var K=y.memo(y.forwardRef((function(e,s){var p=r.useMergeProps(),d=y.useContext(t.PrimeReactContext),f=L.getProps(e,d),m=k(y.useState(""),2),v=m[0],b=m[1],g=k(y.useState(!1),2),h=g[0],E=g[1],x=k(y.useState(-1),2),D=x[0],j=x[1],F=k(y.useState(!1),2),N=F[0],C=F[1],P=y.useRef(!1),U=y.useRef(null),R=y.useRef(null),T=y.useRef(null),G=y.useRef(null),A=y.useRef(f.inputRef),q=y.useRef(f.focusInputRef),K=y.useRef(null),B=y.useRef(null),_=y.useRef(null);y.useRef(null);var J=f.virtualScrollerOptions&&f.virtualScrollerOptions.lazy,X=c.ObjectUtils.isNotEmpty(v),z=f.appendTo||d&&d.appendTo||w.default.appendTo,Z=L.setMetaData(V(V({props:f},f.__parentMetadata),{},{state:{filter:v,focused:h,overlayVisible:N}})),W=Z.ptm,$=Z.cx,Y=Z.sx;n.useHandleStyle(L.css.styles,Z.isUnstyled,{name:"dropdown"});var Q=k(r.useOverlayListener({target:U,overlay:R,listener:function(e,t){t.valid&&("outside"===t.type?!re(e)&&Ae():Ae())},when:N}),2),ee=Q[0],te=Q[1],ne=function(e){return(e||[]).reduce((function(e,t,n){e.push({optionGroup:t,group:!0,index:n,code:t.code,label:t.label});var r=ze(t);return r&&r.forEach((function(t){return e.push(t)})),e}),[])},re=function(e){return c.DomHandler.isAttributeEquals(e.target,"data-pc-section","clearicon")||c.DomHandler.isAttributeEquals(e.target.parentElement||e.target,"data-pc-section","filterclearicon")},oe=function(e){f.showOnFocus&&!N&&Ge(),E(!0),f.onFocus&&f.onFocus(e)},le=function(e){E(!1),f.onBlur&&setTimeout((function(){var t=A.current?A.current.value:void 0;f.onBlur({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:t}})}),200)},ie=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=_e(t);Ue({originalEvent:e,option:r}),n&&Ae()},ae=function(e){if(f.disabled||c.DomHandler.isAndroid())e.preventDefault();else{var t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":he(e);break;case"ArrowUp":ye(e);break;case"ArrowLeft":case"ArrowRight":we(e,f.editable);break;case"Home":Oe(e);break;case"End":Ie(e);break;case"PageDown":xe(e);break;case"PageUp":Ee(e);break;case"Space":Se(e,f.editable);break;case"NumpadEnter":case"Enter":De(e);break;case"Escape":je(e);break;case"Tab":Fe(e);break;case"Backspace":Ne(e,f.editable);break;case"ShiftLeft":case"ShiftRight":break;default:!t&&c.ObjectUtils.isPrintableCharacter(e.key)&&(!N&&!f.editable&&Ge(),!f.editable&&me(e,e.key))}P.current=!1}},ue=function(e){var t;return ce(e)&&(null===(t=Be(e))||void 0===t?void 0:t.toLocaleLowerCase(f.filterLocale).startsWith(_.current.toLocaleLowerCase(f.filterLocale)))},ce=function(e){return c.ObjectUtils.isNotEmpty(e)&&!(Xe(e)||Je(e))},se=function(){return c.ObjectUtils.isNotEmpty(f.value)},pe=function(e){return ce(e)&&He(e)},de=function(){return se?nt.findIndex((function(e){return pe(e)})):-1},fe=function(){var e=de();return e<0?ve():e},me=function(e,t){_.current=(_.current||"")+t;var n=-1,r=!1;return c.ObjectUtils.isNotEmpty(_.current)&&(-1!==(n=-1!==D?-1===(n=nt.slice(D).findIndex((function(e){return ue(e)})))?nt.slice(0,D).findIndex((function(e){return ue(e)})):n+D:nt.findIndex((function(e){return ue(e)})))&&(r=!0),-1===n&&-1===D&&(n=fe()),-1!==n&&ge(e,n)),B.current&&clearTimeout(B.current),B.current=setTimeout((function(){_.current="",B.current=null}),500),r},ve=function(){return nt.findIndex((function(e){return ce(e)}))},be=function(){return c.ObjectUtils.findLastIndex(nt,(function(e){return ce(e)}))},ge=function(e,t){D!==t&&(j(t),f.selectOnFocus&&ie(e,nt[t],!1))},he=function(e){if(N){var t=-1!==D?(r=(n=D)<nt.length-1?nt.slice(n+1).findIndex((function(e){return ce(e)})):-1)>-1?r+n+1:n:P.current?ve():fe();ge(e,t)}else Ge(),f.editable&&ge(e,de());var n,r;e.preventDefault()},ye=function(e){var t,n,r;if(e.altKey&&!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))-1!==D&&ie(e,nt[D]),state.overlayVisible&&Ae(),e.preventDefault();else{var o=-1!==D?(r=(n=D)>0?c.ObjectUtils.findLastIndex(nt.slice(0,n),(function(e){return ce(e)})):-1)>-1?r:n:P.current?be():(t=de())<0?be():t;ge(e,o),!N&&Ge(),e.preventDefault()}},we=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&j(-1)},Oe=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?(e.currentTarget.setSelectionRange(0,0),j(-1)):(ge(e,ve()),!N&&Ge()),e.preventDefault()},Ie=function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var t=e.currentTarget,n=t.value.length;t.setSelectionRange(n,n),j(-1)}else ge(e,be()),!N&&Ge();e.preventDefault()},Ee=function(e){e.preventDefault()},xe=function(e){e.preventDefault()},Se=function(e){!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&De(e)},De=function(e){N?(-1!==D&&ie(e,nt[D]),Ae()):(j(-1),he(e)),e.preventDefault()},je=function(e){N&&Ae(),e.preventDefault()},Fe=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]||(!N||c.DomHandler.getFocusableElements(R.current,':not([data-p-hidden-focusable="true"])').length>0?(-1!==D&&ie(e,nt[D]),N&&Ae()):(c.DomHandler.focus(T.current),e.preventDefault()))},Ne=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&!N&&Ge()},Ce=function(e){var t=null;e.target.value&&(t=nt.findIndex((function(t){return Be(t).toLocaleLowerCase().startsWith(e.target.value.toLocaleLowerCase())}))),j(t),f.onChange&&f.onChange({originalEvent:e.originalEvent,value:e.target.value,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:e.target.value}})},ke=function(e){E(!0),Ae(),f.onFocus&&f.onFocus(e)},Le=function(e){b(""),f.onFilter&&f.onFilter({filter:""}),e&&e()},Pe=function(e){f.onChange&&f.onChange({originalEvent:e,value:void 0,stopPropagation:function(){null==e||e.stopPropagation()},preventDefault:function(){null==e||e.preventDefault()},target:{name:f.name,id:f.id,value:void 0}}),f.filter&&Le(),Ke()},Ue=function(e){if(rt!==e.option){Ke(e.option),j(-1);var t=_e(e.option),n=Me(e.option,nt);f.onChange&&f.onChange({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:t}}),ge(e.originalEvent,n)}},Re=function(e){if(e=e||nt,null!=f.value&&e){if(!f.optionGroupLabel)return Me(f.value,e);for(var t=0;t<e.length;t++){var n=Me(f.value,ze(e[t]));if(-1!==n)return{group:t,option:n}}}return-1},Te=function(){return f.optionValue?null:f.dataKey},Me=function(e,t){var n=Te();return t.findIndex((function(t){return c.ObjectUtils.equals(e,_e(t),n)}))},He=function(e){return c.ObjectUtils.equals(f.value,_e(e),Te())},Ge=function(){j(-1!==D?D:f.autoOptionFocus?fe():f.editable?-1:de()),C(!0)},Ae=function(){C(!1),P.current=!1},qe=function(){c.DomHandler.alignOverlay(R.current,A.current.parentElement,f.appendTo||d&&d.appendTo||w.default.appendTo)},Ve=function(){var e=c.DomHandler.findSingle(R.current,'li[data-p-focused="true"]');if(e&&e.scrollIntoView)e.scrollIntoView({block:"nearest",inline:"nearest"});else{var t=c.DomHandler.findSingle(R.current,'li[data-p-highlight="true"]');t&&t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"nearest"})}},Ke=function(e){A.current&&(A.current.value=e?Be(e):f.value||"",q.current&&(q.current.value=A.current.value))},Be=function(e){return c.ObjectUtils.resolveFieldData(e,f.optionLabel?f.optionLabel:"label")},_e=function(e){return f.optionValue?c.ObjectUtils.resolveFieldData(e,f.optionValue):c.ObjectUtils.resolveFieldData(e,"value")||e},Je=function(e){return f.optionGroupLabel&&e.optionGroup&&e.group},Xe=function(e){return f.optionDisabled?c.ObjectUtils.isFunction(f.optionDisabled)?f.optionDisabled(e):c.ObjectUtils.resolveFieldData(e,f.optionDisabled):!(!e||void 0===e.disabled)&&e.disabled},ze=function(e){return c.ObjectUtils.resolveFieldData(e,f.optionGroupChildren)},Ze=function(){if(f.editable&&A.current){var e=(rt?Be(rt):null)||f.value||"";A.current.value=e,q.current&&(q.current.value=e)}};y.useImperativeHandle(s,(function(){return{props:f,show:Ge,hide:Ae,clear:Pe,focus:function(){return c.DomHandler.focus(q.current)},getElement:function(){return U.current},getOverlay:function(){return R.current},getInput:function(){return A.current},getFocusInput:function(){return q.current},getVirtualScroller:function(){return K.current}}})),y.useEffect((function(){c.ObjectUtils.combinedRefs(A,f.inputRef),c.ObjectUtils.combinedRefs(q,f.focusInputRef)}),[A,f.inputRef,q,f.focusInputRef]),r.useMountEffect((function(){f.autoFocus&&c.DomHandler.focus(q.current,f.autoFocus),qe()})),r.useUpdateEffect((function(){N&&(f.value||D>=0)&&Ve()}),[N,f.value,D]),r.useUpdateEffect((function(){N&&v&&f.filter&&qe()}),[N,v,f.filter]),r.useUpdateEffect((function(){!v||f.options&&0!==f.options.length||b(""),Ze(),A.current&&(A.current.selectedIndex=1)})),r.useUnmountEffect((function(){c.ZIndexUtils.clear(R.current)}));var We,$e,Ye,Qe,et,tt=function(e){"Enter"!==e.key&&"Space"!==e.code||(Pe(e),e.preventDefault())},nt=function(){var e=f.optionGroupLabel?ne(f.options):f.options;if(X&&!J){var n=v.trim().toLocaleLowerCase(f.filterLocale),r=f.filterBy?f.filterBy.split(","):[f.optionLabel||"label"];if(f.optionGroupLabel){var o,l=[],i=H(f.options);try{for(i.s();!(o=i.n()).done;){var a=o.value,u=t.FilterService.filter(ze(a),r,n,f.filterMatchMode,f.filterLocale);u&&u.length&&l.push(V(V({},a),S({},"".concat(f.optionGroupChildren),u)))}}catch(e){i.e(e)}finally{i.f()}return ne(l)}return t.FilterService.filter(e,r,n,f.filterMatchMode,f.filterLocale)}return e}(),rt=-1!==(We=Re(f.options))?f.optionGroupLabel?ze(f.options[We.group])[We.option]:f.options[We]:null,ot=c.ObjectUtils.isNotEmpty(f.tooltip),lt=L.getOtherProps(f),it=c.ObjectUtils.reduceKeys(lt,c.DomHandler.ARIA_PROPS),at=function(){var e={value:"",label:f.placeholder};if(rt){var t=_e(rt);e={value:"object"===I(t)?f.options.findIndex((function(e){return e===t})):t,label:Be(rt)}}var n=p({className:"p-hidden-accessible p-dropdown-hidden-select"},W("hiddenSelectedMessage")),r=p({ref:A,required:f.required,defaultValue:e.value,name:f.name,tabIndex:-1,"aria-hidden":"true"},W("select")),o=p({value:e.value},W("option"));return y.createElement("div",n,y.createElement("select",r,y.createElement("option",o,e.label)))}(),ut=function(){var e=c.ObjectUtils.isNotEmpty(rt)?Be(rt):null;f.editable&&(e=e||f.value||"");var t=p({className:"p-hidden-accessible"},W("hiddenSelectedMessage")),n=p(V({ref:q,id:f.inputId,defaultValue:e,type:"text",readOnly:!0,"aria-haspopup":"listbox",onFocus:oe,onBlur:le,onKeyDown:ae,disabled:f.disabled,tabIndex:f.disabled?-1:f.tabIndex||0},it),W("input"));return y.createElement("div",t,y.createElement("input",n))}(),ct=function(){var e=c.ObjectUtils.isNotEmpty(rt)?Be(rt):null;if(f.editable){var t=p(V({ref:A,type:"text",defaultValue:e||f.value||"",className:$("input",{label:e}),disabled:f.disabled,placeholder:f.placeholder,maxLength:f.maxLength,onInput:Ce,onFocus:ke,onKeyDown:ae,onBlur:le,tabIndex:f.disabled?-1:f.tabIndex||0,"aria-haspopup":"listbox"},it),W("input"));return y.createElement("input",t)}var n=f.valueTemplate?c.ObjectUtils.getJSXElement(f.valueTemplate,rt,f):e||f.placeholder||"empty",r=p({ref:A,className:$("input",{label:e}),tabIndex:"-1"},W("input"));return y.createElement("span",r,n)}(),st=f.loading?($e=p({className:$("loadingIcon"),"data-pr-overlay-visible":N},W("loadingIcon")),Ye=c.IconUtils.getJSXIcon(f.loadingIcon||y.createElement(l.SpinnerIcon,{spin:!0}),V({},$e),{props:f}),Qe=f.placeholder||f.ariaLabel,et=p({className:$("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":N,"aria-label":Qe},W("trigger")),y.createElement("div",et,Ye)):function(){var e=p({className:$("dropdownIcon"),"data-pr-overlay-visible":N},W("dropdownIcon")),t=c.IconUtils.getJSXIcon(f.dropdownIcon||y.createElement(o.ChevronDownIcon,e),V({},e),{props:f}),n=f.placeholder||f.ariaLabel,r=p({className:$("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":N,"aria-label":n},W("trigger"));return y.createElement("div",r,t)}(),pt=function(){if(null!=f.value&&f.showClear&&!f.disabled){var e=p({className:$("clearIcon"),onPointerUp:Pe,tabIndex:f.tabIndex||"0",onKeyDown:tt,"aria-label":t.localeOption("clear")},W("clearIcon"));return c.IconUtils.getJSXIcon(f.clearIcon||y.createElement(i.TimesIcon,e),V({},e),{props:f})}return null}(),dt=p({id:f.id,ref:U,className:c.classNames(f.className,$("root",{context:d,focusedState:h,overlayVisibleState:N})),style:f.style,onClick:function(e){return t=e,void(f.disabled||f.loading||(f.onClick&&f.onClick(t),t.defaultPrevented||re(t)||"INPUT"===t.target.tagName||(R.current&&R.current&&R.current.contains(t.target)||(c.DomHandler.focus(q.current),N?Ae():Ge()),P.current=!0)));var t},onMouseDown:f.onMouseDown,onContextMenu:f.onContextMenu,onFocus:function(){f.editable&&!N&&!1===P.current&&c.DomHandler.focus(A.current)},"data-p-disabled":f.disabled,"data-p-focus":h},lt,W("root")),ft=p({ref:T,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===q.current?c.DomHandler.getFirstFocusableElement(R.current,':not([data-p-hidden-focusable="true"])'):q.current;c.DomHandler.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},W("hiddenFirstFocusableEl")),mt=p({ref:G,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===q.current?c.DomHandler.getLastFocusableElement(R.current,':not([data-p-hidden-focusable="true"])'):q.current;c.DomHandler.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},W("hiddenLastFocusableEl"));return y.createElement(y.Fragment,null,y.createElement("div",dt,ut,at,ct,pt,st,y.createElement(M,O({hostName:"Dropdown",ref:R,visibleOptions:nt,virtualScrollerRef:K},f,{appendTo:z,cx:$,filterValue:v,focusedOptionIndex:D,getOptionGroupChildren:ze,getOptionGroupLabel:function(e){return c.ObjectUtils.resolveFieldData(e,f.optionGroupLabel)},getOptionGroupRenderKey:function(e){return c.ObjectUtils.resolveFieldData(e,f.optionGroupLabel)},getOptionLabel:Be,getOptionRenderKey:function(e){return f.dataKey?c.ObjectUtils.resolveFieldData(e,f.dataKey):Be(e)},getSelectedOptionIndex:Re,hasFilter:X,in:N,isOptionDisabled:Xe,isSelected:He,onClick:function(e){a.OverlayService.emit("overlay-click",{originalEvent:e,target:U.current})},onEnter:function(e){c.ZIndexUtils.set("overlay",R.current,d&&d.autoZIndex||w.default.autoZIndex,d&&d.zIndex.overlay||w.default.zIndex.overlay),c.DomHandler.addStyles(R.current,{position:"absolute",top:"0",left:"0"}),qe(),e&&e()},onEntered:function(e){e&&e(),ee(),f.onShow&&f.onShow()},onExit:function(){te()},onExited:function(){f.filter&&f.resetFilterOnHide&&Le(),c.ZIndexUtils.clear(R.current),f.onHide&&f.onHide()},onFilterClearIconClick:function(e){Le(e)},onFilterInputChange:function(e){var t=e.target.value;b(t),f.onFilter&&f.onFilter({originalEvent:e,filter:t})},onFilterInputKeyDown:function(e){switch(e.code){case"ArrowDown":he(e);break;case"ArrowUp":ye(e);break;case"ArrowLeft":case"ArrowRight":we(e,!0);break;case"Escape":case"Enter":case"NumpadEnter":De(e),e.preventDefault()}},onOptionClick:function(e){e.option.disabled||(Ue(e),c.DomHandler.focus(q.current)),Ae()},ptm:W,resetFilter:Le,changeFocusedOptionIndex:ge,firstFocusableElement:y.createElement("span",ft),lastFocusableElement:y.createElement("span",mt),sx:Y}))),ot&&y.createElement(u.Tooltip,O({target:U,content:f.tooltip,pt:W("tooltip")},f.tooltipOptions)))})));K.displayName="Dropdown",exports.Dropdown=K;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),n=require("primereact/componentbase"),r=require("primereact/hooks"),o=require("primereact/icons/chevrondown"),l=require("primereact/icons/spinner"),i=require("primereact/icons/times"),a=require("primereact/overlayservice"),u=require("primereact/tooltip"),c=require("primereact/utils"),s=require("primereact/csstransition"),p=require("primereact/icons/search"),d=require("primereact/portal"),f=require("primereact/virtualscroller"),m=require("primereact/ripple"),v=require("primereact/icons/check"),b=require("primereact/iconbase");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function h(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var y=h(e),w=g(t);function O(){return O=Object.assign?Object.assign.bind():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},O.apply(this,arguments)}function I(e){return I="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},I(e)}function E(e,t){if("object"!==I(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function x(e){var t=E(e,"string");return"symbol"===I(t)?t:String(t)}function S(e,t,n){return(t=x(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e){if(Array.isArray(e))return e}function j(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,l,i,a=[],u=!0,c=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=l.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return a}}function F(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 N(e,t){if(e){if("string"==typeof e)return F(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)?F(e,t):void 0}}function C(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function k(e,t){return D(e)||j(e,t)||N(e,t)||C()}var L=n.ComponentBase.extend({defaultProps:{__TYPE:"Dropdown",__parentMetadata:null,appendTo:null,ariaLabel:null,ariaLabelledBy:null,autoFocus:!1,children:void 0,className:null,clearIcon:null,dataKey:null,disabled:!1,dropdownIcon:null,editable:!1,emptyFilterMessage:null,highlightOnSelect:!0,checkmark:!1,emptyMessage:null,filter:!1,filterBy:null,filterClearIcon:null,filterIcon:null,filterInputAutoFocus:!1,filterLocale:void 0,filterMatchMode:"contains",filterPlaceholder:null,filterTemplate:null,focusInputRef:null,id:null,inputId:null,inputRef:null,invalid:!1,variant:null,itemTemplate:null,loading:!1,loadingIcon:null,maxLength:null,name:null,onBlur:null,onChange:null,onContextMenu:null,onFilter:null,onFocus:null,onHide:null,onMouseDown:null,onShow:null,optionDisabled:null,optionGroupChildren:"items",selectOnFocus:!1,focusOnHover:!0,autoOptionFocus:!1,optionGroupLabel:null,optionGroupTemplate:null,optionLabel:null,optionValue:null,options:null,panelClassName:null,panelFooterTemplate:null,panelStyle:null,placeholder:null,required:!1,resetFilterOnHide:!1,scrollHeight:"200px",showClear:!1,showFilterClear:!1,showOnFocus:!1,style:null,tabIndex:null,tooltip:null,tooltipOptions:null,transitionOptions:null,value:null,valueTemplate:null,virtualScrollerOptions:null},css:{classes:{root:function(e){var t=e.props,n=e.focusedState,r=e.overlayVisibleState,o=e.context;return c.classNames("p-dropdown p-component p-inputwrapper",{"p-disabled":t.disabled,"p-invalid":t.invalid,"p-focus":n,"p-variant-filled":t.variant?"filled"===t.variant:o&&"filled"===o.inputStyle,"p-dropdown-clearable":t.showClear&&!t.disabled,"p-inputwrapper-filled":c.ObjectUtils.isNotEmpty(t.value),"p-inputwrapper-focus":n||r})},input:function(e){var t=e.props,n=e.label;return t.editable?"p-dropdown-label p-inputtext":c.classNames("p-dropdown-label p-inputtext",{"p-placeholder":null===n&&t.placeholder,"p-dropdown-label-empty":null===n&&!t.placeholder})},trigger:"p-dropdown-trigger",emptyMessage:"p-dropdown-empty-message",itemGroup:function(e){var t=e.optionGroupLabel;return c.classNames("p-dropdown-item-group",{"p-dropdown-item-empty":!t||0===t.length})},itemGroupLabel:"p-dropdown-item-group-label",dropdownIcon:"p-dropdown-trigger-icon p-clickable",loadingIcon:"p-dropdown-trigger-icon p-clickable",clearIcon:"p-dropdown-clear-icon p-clickable",filterIcon:"p-dropdown-filter-icon",filterClearIcon:"p-dropdown-filter-clear-icon",filterContainer:function(e){return c.classNames("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!e.clearIcon})},filterInput:function(e){var t=e.props,n=e.context;return c.classNames("p-dropdown-filter p-inputtext p-component",{"p-variant-filled":t.variant?"filled"===t.variant:n&&"filled"===n.inputStyle})},list:function(e){return"p-dropdown-items"},panel:function(e){var t=e.context;return c.classNames("p-dropdown-panel p-component",{"p-input-filled":t&&"filled"===t.inputStyle||"filled"===w.default.inputStyle,"p-ripple-disabled":t&&!1===t.ripple||!1===w.default.ripple})},item:function(e){var t=e.label;return c.classNames("p-dropdown-item",{"p-highlight":e.selected&&e.highlightOnSelect,"p-disabled":e.disabled,"p-focus":e.index===e.focusedOptionIndex,"p-dropdown-item-empty":!t||0===t.length})},itemLabel:"p-dropdown-item-label",checkIcon:"p-dropdown-check-icon",blankIcon:"p-dropdown-blank-icon",wrapper:"p-dropdown-items-wrapper",header:"p-dropdown-header",footer:"p-dropdown-footer",transition:"p-connected-overlay"},styles:"\n@layer primereact {\n .p-dropdown {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n }\n \n .p-dropdown-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n \n .p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n \n .p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n }\n \n input.p-dropdown-label {\n cursor: default;\n }\n \n .p-dropdown .p-dropdown-panel {\n min-width: 100%;\n }\n \n .p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n }\n \n .p-dropdown-items-wrapper {\n overflow: auto;\n }\n \n .p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n }\n \n .p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n \n .p-dropdown-filter {\n width: 100%;\n }\n \n .p-dropdown-filter-container {\n position: relative;\n }\n \n .p-dropdown-clear-icon,\n .p-dropdown-filter-icon,\n .p-dropdown-filter-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-fluid .p-dropdown {\n display: flex;\n }\n \n .p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n }\n}\n",inlineStyles:{wrapper:function(e){return{maxHeight:e.props.scrollHeight||"auto"}},panel:function(e){}}}}),P=y.memo(y.forwardRef((function(e,t){var n=b.IconBase.getPTI(e);return y.createElement("svg",O({ref:t,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),y.createElement("rect",{width:"1",height:"1",fill:"currentColor",fillOpacity:"0"}))})));P.displayName="BlankIcon";var U=y.memo((function(e){var t=r.useMergeProps(),n=e.ptm,o=e.cx,l=e.selected,i=e.disabled,a=e.option,u=e.label,s=e.index,p=e.focusedOptionIndex,d=e.checkmark,f=e.highlightOnSelect,b=function(e){return n(e,{context:{selected:l,disabled:i}})},g=e.template?c.ObjectUtils.getJSXElement(e.template,e.option):e.label,h=t({role:"option",key:e.label,className:c.classNames(a.className,o("item",{selected:l,disabled:i,label:u,index:s,focusedOptionIndex:p,highlightOnSelect:f})),style:e.style,onClick:function(t){return n=t,void(e.onClick&&e.onClick({originalEvent:n,option:a}));var n},onMouseMove:function(t){return null==e?void 0:e.onMouseMove(t,s)},"aria-label":u,"aria-selected":l,"data-p-highlight":l,"data-p-focused":p===s,"data-p-disabled":i},b("item")),w=t({className:o("itemLabel")},b("itemLabel"));return y.createElement("li",h,d&&function(){if(l){var e=t({className:o("checkIcon")},b("checkIcon"));return y.createElement(v.CheckIcon,e)}var n=t({className:o("blankIcon")},b("blankIcon"));return y.createElement(P,n)}(),y.createElement("span",w,g),y.createElement(m.Ripple,null))}));function R(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 T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}U.displayName="DropdownItem";var M=y.memo(y.forwardRef((function(e,n){var o,l,a,u,m,v=r.useMergeProps(),b=e.ptm,g=e.cx,h=e.sx,w=y.useContext(t.PrimeReactContext),I=y.useRef(null),E=!(e.visibleOptions&&e.visibleOptions.length)&&e.hasFilter,x={filter:function(e){return F(e)},reset:function(){return e.resetFilter()}},S=function(t,n){return b(t,T({hostName:e.hostName},n))},D=function(){e.onEnter((function(){if(e.virtualScrollerRef.current){var t=e.getSelectedOptionIndex();-1!==t&&setTimeout((function(){return e.virtualScrollerRef.current.scrollToIndex(t)}),0)}}))},j=function(){e.onEntered((function(){e.filter&&e.filterInputAutoFocus&&c.DomHandler.focus(I.current,!1)}))},F=function(t){e.virtualScrollerRef.current&&e.virtualScrollerRef.current.scrollToIndex(0),e.onFilterInputChange&&e.onFilterInputChange(t)},N=function(){if(e.panelFooterTemplate){var t=c.ObjectUtils.getJSXElement(e.panelFooterTemplate,e,e.onOverlayHide),n=v({className:g("footer")},S("footer"));return y.createElement("div",n,t)}return null},C=function(t,n){var r;e.focusOnHover&&(null==e||null===(r=e.changeFocusedOptionIndex)||void 0===r||r.call(e,t,n))},k=function(n,r){var o=c.ObjectUtils.getJSXElement(n,e)||t.localeOption(r?"emptyFilterMessage":"emptyMessage"),l=v({className:g("emptyMessage")},S("emptyMessage"));return y.createElement("li",l,o)},L=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o={height:r.props?r.props.itemSize:void 0};if(o=T(T({},o),t.style),t.group&&t.optionGroup&&e.optionGroupLabel){var l=e.optionGroupLabel,i=e.optionGroupTemplate?c.ObjectUtils.getJSXElement(e.optionGroupTemplate,t,n):e.getOptionGroupLabel(t),a=n+"_"+e.getOptionGroupRenderKey(t),u=v({className:g("itemGroup",{optionGroupLabel:l}),style:o,"data-p-highlight":e.selected},S("itemGroup")),s=v({className:g("itemGroupLabel")},S("itemGroupLabel"));return y.createElement("li",O({key:a},u),y.createElement("span",s,i))}var p=e.getOptionRenderKey(t)+"_"+n,d=e.getOptionLabel(t),f=e.isOptionDisabled(t);return y.createElement(U,{key:p,label:d,index:n,focusedOptionIndex:e.focusedOptionIndex,option:t,style:o,template:e.itemTemplate,selected:e.isSelected(t),highlightOnSelect:e.highlightOnSelect,disabled:f,onClick:e.onOptionClick,onMouseMove:C,ptm:b,cx:g,checkmark:e.checkmark})},P=function(){if(e.showFilterClear&&e.filterValue){var n=t.localeOption("clear"),r=v({className:g("filterClearIcon"),"aria-label":n,onClick:function(){return e.onFilterClearIconClick((function(){return c.DomHandler.focus(I.current)}))}},S("filterClearIcon"));return c.IconUtils.getJSXIcon(e.filterClearIcon||y.createElement(i.TimesIcon,r),T({},r),{props:e})}return null},R=function(){if(e.filter){var t=P(),n=v({className:g("filterIcon")},S("filterIcon")),r=c.IconUtils.getJSXIcon(e.filterIcon||y.createElement(p.SearchIcon,n),T({},n),{props:e}),o=v({className:g("filterContainer",{clearIcon:t})},S("filterContainer")),l=v({ref:I,type:"text",autoComplete:"off",className:g("filterInput",{context:w}),placeholder:e.filterPlaceholder,onKeyDown:e.onFilterInputKeyDown,onChange:function(e){return F(e)},value:e.filterValue},S("filterInput")),i=y.createElement("div",o,y.createElement("input",l),t,r);if(e.filterTemplate){var a={className:c.classNames("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!t}),element:i,filterOptions:x,filterInputKeyDown:e.onFilterInputKeyDown,filterInputChange:F,filterIconClassName:"p-dropdown-filter-icon",clearIcon:t,props:e};i=c.ObjectUtils.getJSXElement(e.filterTemplate,a)}var u=v({className:g("header")},S("header"));return y.createElement("div",u,i)}return null},M=function(){if(e.virtualScrollerOptions){var t=T(T({},e.virtualScrollerOptions),{style:T(T({},e.virtualScrollerOptions.style),{height:e.scrollHeight}),className:c.classNames("p-dropdown-items-wrapper",e.virtualScrollerOptions.className),items:e.visibleOptions,autoSize:!0,onLazyLoad:function(t){return e.virtualScrollerOptions.onLazyLoad(T(T({},t),{filter:e.filterValue}))},itemTemplate:function(e,t){return e&&L(e,t.index,t)},contentTemplate:function(t){var n=E?k(e.hasFilter?e.emptyFilterMessage:e.emptyMessage):t.children,r=v({ref:t.contentRef,style:t.style,className:c.classNames(t.className,g("list",{virtualScrollerProps:e.virtualScrollerOptions})),role:"listbox"},S("list"));return y.createElement("ul",r,n)}});return y.createElement(f.VirtualScroller,O({ref:e.virtualScrollerRef},t,{pt:b("virtualScroller")}))}var n=c.ObjectUtils.isNotEmpty(e.visibleOptions)?e.visibleOptions.map(L):e.hasFilter?k(e.emptyFilterMessage,!0):k(e.emptyMessage),r=v({className:g("wrapper"),style:h("wrapper")},S("wrapper")),o=v({className:g("list"),role:"listbox"},S("list"));return y.createElement("div",r,y.createElement("ul",o,n))},H=(o=R(),l=M(),a=N(),u=v({className:c.classNames(e.panelClassName,g("panel",{context:w})),style:h("panel"),onClick:e.onClick},S("panel")),m=v({classNames:g("transition"),in:e.in,timeout:{enter:120,exit:100},options:e.transitionOptions,unmountOnExit:!0,onEnter:D,onEntered:j,onExit:e.onExit,onExited:e.onExited},S("transition")),y.createElement(s.CSSTransition,O({nodeRef:n},m),y.createElement("div",O({ref:n},u),e.firstFocusableElement,o,l,a,e.lastFocusableElement)));return y.createElement(d.Portal,{element:H,appendTo:e.appendTo})})));function H(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=G(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 l,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,l=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw l}}}}function G(e,t){if(e){if("string"==typeof e)return A(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)?A(e,t):void 0}}function A(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 q(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 V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}M.displayName="DropdownPanel";var K=y.memo(y.forwardRef((function(e,s){var p=r.useMergeProps(),d=y.useContext(t.PrimeReactContext),f=L.getProps(e,d),m=k(y.useState(""),2),v=m[0],b=m[1],g=k(y.useState(!1),2),h=g[0],E=g[1],x=k(y.useState(-1),2),D=x[0],j=x[1],F=k(y.useState(!1),2),N=F[0],C=F[1],P=y.useRef(!1),U=y.useRef(null),R=y.useRef(null),T=y.useRef(null),G=y.useRef(null),A=y.useRef(f.inputRef),q=y.useRef(f.focusInputRef),K=y.useRef(null),B=y.useRef(null),_=y.useRef(null);y.useRef(null);var J=f.virtualScrollerOptions&&f.virtualScrollerOptions.lazy,X=c.ObjectUtils.isNotEmpty(v),z=f.appendTo||d&&d.appendTo||w.default.appendTo,Z=L.setMetaData(V(V({props:f},f.__parentMetadata),{},{state:{filter:v,focused:h,overlayVisible:N}})),W=Z.ptm,$=Z.cx,Y=Z.sx;n.useHandleStyle(L.css.styles,Z.isUnstyled,{name:"dropdown"});var Q=k(r.useOverlayListener({target:U,overlay:R,listener:function(e,t){t.valid&&("outside"===t.type?!re(e)&&Ae():Ae())},when:N}),2),ee=Q[0],te=Q[1],ne=function(e){return(e||[]).reduce((function(e,t,n){e.push({optionGroup:t,group:!0,index:n,code:t.code,label:t.label});var r=ze(t);return r&&r.forEach((function(t){return e.push(t)})),e}),[])},re=function(e){return c.DomHandler.isAttributeEquals(e.target,"data-pc-section","clearicon")||c.DomHandler.isAttributeEquals(e.target.parentElement||e.target,"data-pc-section","filterclearicon")},oe=function(e){f.showOnFocus&&!N&&Ge(),E(!0),f.onFocus&&f.onFocus(e)},le=function(e){E(!1),f.onBlur&&setTimeout((function(){var t=A.current?A.current.value:void 0;f.onBlur({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:t}})}),200)},ie=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=_e(t);Ue({originalEvent:e,option:r}),n&&Ae()},ae=function(e){if(f.disabled||c.DomHandler.isAndroid())e.preventDefault();else{var t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":he(e);break;case"ArrowUp":ye(e);break;case"ArrowLeft":case"ArrowRight":we(e,f.editable);break;case"Home":Oe(e);break;case"End":Ie(e);break;case"PageDown":xe(e);break;case"PageUp":Ee(e);break;case"Space":Se(e,f.editable);break;case"NumpadEnter":case"Enter":De(e);break;case"Escape":je(e);break;case"Tab":Fe(e);break;case"Backspace":Ne(e,f.editable);break;case"ShiftLeft":case"ShiftRight":break;default:!t&&c.ObjectUtils.isPrintableCharacter(e.key)&&(!N&&!f.editable&&Ge(),!f.editable&&me(e,e.key))}P.current=!1}},ue=function(e){var t;return ce(e)&&(null===(t=Be(e))||void 0===t?void 0:t.toLocaleLowerCase(f.filterLocale).startsWith(_.current.toLocaleLowerCase(f.filterLocale)))},ce=function(e){return c.ObjectUtils.isNotEmpty(e)&&!(Xe(e)||Je(e))},se=function(){return c.ObjectUtils.isNotEmpty(f.value)},pe=function(e){return ce(e)&&He(e)},de=function(){return se?nt.findIndex((function(e){return pe(e)})):-1},fe=function(){var e=de();return e<0?ve():e},me=function(e,t){_.current=(_.current||"")+t;var n=-1,r=!1;return c.ObjectUtils.isNotEmpty(_.current)&&(-1!==(n=-1!==D?-1===(n=nt.slice(D).findIndex((function(e){return ue(e)})))?nt.slice(0,D).findIndex((function(e){return ue(e)})):n+D:nt.findIndex((function(e){return ue(e)})))&&(r=!0),-1===n&&-1===D&&(n=fe()),-1!==n&&ge(e,n)),B.current&&clearTimeout(B.current),B.current=setTimeout((function(){_.current="",B.current=null}),500),r},ve=function(){return nt.findIndex((function(e){return ce(e)}))},be=function(){return c.ObjectUtils.findLastIndex(nt,(function(e){return ce(e)}))},ge=function(e,t){D!==t&&(j(t),f.selectOnFocus&&ie(e,nt[t],!1))},he=function(e){if(N){var t=-1!==D?(r=(n=D)<nt.length-1?nt.slice(n+1).findIndex((function(e){return ce(e)})):-1)>-1?r+n+1:n:P.current?ve():fe();ge(e,t)}else Ge(),f.editable&&ge(e,de());var n,r;e.preventDefault()},ye=function(e){var t,n,r;if(e.altKey&&!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))-1!==D&&ie(e,nt[D]),state.overlayVisible&&Ae(),e.preventDefault();else{var o=-1!==D?(r=(n=D)>0?c.ObjectUtils.findLastIndex(nt.slice(0,n),(function(e){return ce(e)})):-1)>-1?r:n:P.current?be():(t=de())<0?be():t;ge(e,o),!N&&Ge(),e.preventDefault()}},we=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&j(-1)},Oe=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?(e.currentTarget.setSelectionRange(0,0),j(-1)):(ge(e,ve()),!N&&Ge()),e.preventDefault()},Ie=function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var t=e.currentTarget,n=t.value.length;t.setSelectionRange(n,n),j(-1)}else ge(e,be()),!N&&Ge();e.preventDefault()},Ee=function(e){e.preventDefault()},xe=function(e){e.preventDefault()},Se=function(e){!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&De(e)},De=function(e){N?(-1!==D&&ie(e,nt[D]),Ae()):(j(-1),he(e)),e.preventDefault()},je=function(e){N&&Ae(),e.preventDefault()},Fe=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]||(!N||c.DomHandler.getFocusableElements(R.current,':not([data-p-hidden-focusable="true"])').length>0?(-1!==D&&ie(e,nt[D]),N&&Ae()):(c.DomHandler.focus(T.current),e.preventDefault()))},Ne=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&!N&&Ge()},Ce=function(e){var t=null;e.target.value&&(t=nt.findIndex((function(t){return Be(t).toLocaleLowerCase().startsWith(e.target.value.toLocaleLowerCase())}))),j(t),f.onChange&&f.onChange({originalEvent:e.originalEvent,value:e.target.value,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:e.target.value}})},ke=function(e){E(!0),Ae(),f.onFocus&&f.onFocus(e)},Le=function(e){b(""),f.onFilter&&f.onFilter({filter:""}),e&&e()},Pe=function(e){f.onChange&&f.onChange({originalEvent:e,value:void 0,stopPropagation:function(){null==e||e.stopPropagation()},preventDefault:function(){null==e||e.preventDefault()},target:{name:f.name,id:f.id,value:void 0}}),f.filter&&Le(),Ke()},Ue=function(e){if(rt!==e.option){Ke(e.option),j(-1);var t=_e(e.option),n=Me(e.option,nt);f.onChange&&f.onChange({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:t}}),ge(e.originalEvent,n)}},Re=function(e){if(e=e||nt,null!=f.value&&e){if(!f.optionGroupLabel)return Me(f.value,e);for(var t=0;t<e.length;t++){var n=Me(f.value,ze(e[t]));if(-1!==n)return{group:t,option:n}}}return-1},Te=function(){return f.optionValue?null:f.dataKey},Me=function(e,t){var n=Te();return t.findIndex((function(t){return c.ObjectUtils.equals(e,_e(t),n)}))},He=function(e){return c.ObjectUtils.equals(f.value,_e(e),Te())},Ge=function(){j(-1!==D?D:f.autoOptionFocus?fe():f.editable?-1:de()),C(!0)},Ae=function(){C(!1),P.current=!1},qe=function(){c.DomHandler.alignOverlay(R.current,A.current.parentElement,f.appendTo||d&&d.appendTo||w.default.appendTo)},Ve=function(){var e=c.DomHandler.findSingle(R.current,'li[data-p-focused="true"]');if(e&&e.scrollIntoView)e.scrollIntoView({block:"nearest",inline:"nearest"});else{var t=c.DomHandler.findSingle(R.current,'li[data-p-highlight="true"]');t&&t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"nearest"})}},Ke=function(e){A.current&&(A.current.value=e?Be(e):f.value||"",q.current&&(q.current.value=A.current.value))},Be=function(e){return f.optionLabel?c.ObjectUtils.resolveFieldData(e,f.optionLabel):c.ObjectUtils.resolveFieldData(e,"label")||e},_e=function(e){return f.optionValue?c.ObjectUtils.resolveFieldData(e,f.optionValue):c.ObjectUtils.resolveFieldData(e,"value")||e},Je=function(e){return f.optionGroupLabel&&e.optionGroup&&e.group},Xe=function(e){return f.optionDisabled?c.ObjectUtils.isFunction(f.optionDisabled)?f.optionDisabled(e):c.ObjectUtils.resolveFieldData(e,f.optionDisabled):!(!e||void 0===e.disabled)&&e.disabled},ze=function(e){return c.ObjectUtils.resolveFieldData(e,f.optionGroupChildren)},Ze=function(){if(f.editable&&A.current){var e=(rt?Be(rt):null)||f.value||"";A.current.value=e,q.current&&(q.current.value=e)}};y.useImperativeHandle(s,(function(){return{props:f,show:Ge,hide:Ae,clear:Pe,focus:function(){return c.DomHandler.focus(q.current)},getElement:function(){return U.current},getOverlay:function(){return R.current},getInput:function(){return A.current},getFocusInput:function(){return q.current},getVirtualScroller:function(){return K.current}}})),y.useEffect((function(){c.ObjectUtils.combinedRefs(A,f.inputRef),c.ObjectUtils.combinedRefs(q,f.focusInputRef)}),[A,f.inputRef,q,f.focusInputRef]),r.useMountEffect((function(){f.autoFocus&&c.DomHandler.focus(q.current,f.autoFocus),qe()})),r.useUpdateEffect((function(){N&&(f.value||D>=0)&&Ve()}),[N,f.value,D]),r.useUpdateEffect((function(){N&&v&&f.filter&&qe()}),[N,v,f.filter]),r.useUpdateEffect((function(){!v||f.options&&0!==f.options.length||b(""),Ze(),A.current&&(A.current.selectedIndex=1)})),r.useUnmountEffect((function(){c.ZIndexUtils.clear(R.current)}));var We,$e,Ye,Qe,et,tt=function(e){"Enter"!==e.key&&"Space"!==e.code||(Pe(e),e.preventDefault())},nt=function(){var e=f.optionGroupLabel?ne(f.options):f.options;if(X&&!J){var n=v.trim().toLocaleLowerCase(f.filterLocale),r=f.filterBy?f.filterBy.split(","):[f.optionLabel||"label"];if(f.optionGroupLabel){var o,l=[],i=H(f.options);try{for(i.s();!(o=i.n()).done;){var a=o.value,u=t.FilterService.filter(ze(a),r,n,f.filterMatchMode,f.filterLocale);u&&u.length&&l.push(V(V({},a),S({},"".concat(f.optionGroupChildren),u)))}}catch(e){i.e(e)}finally{i.f()}return ne(l)}return t.FilterService.filter(e,r,n,f.filterMatchMode,f.filterLocale)}return e}(),rt=-1!==(We=Re(f.options))?f.optionGroupLabel?ze(f.options[We.group])[We.option]:f.options[We]:null,ot=c.ObjectUtils.isNotEmpty(f.tooltip),lt=L.getOtherProps(f),it=c.ObjectUtils.reduceKeys(lt,c.DomHandler.ARIA_PROPS),at=function(){var e={value:"",label:f.placeholder};if(rt){var t=_e(rt);e={value:"object"===I(t)?f.options.findIndex((function(e){return e===t})):t,label:Be(rt)}}var n=p({className:"p-hidden-accessible p-dropdown-hidden-select"},W("hiddenSelectedMessage")),r=p({ref:A,required:f.required,defaultValue:e.value,name:f.name,tabIndex:-1,"aria-hidden":"true"},W("select")),o=p({value:e.value},W("option"));return y.createElement("div",n,y.createElement("select",r,y.createElement("option",o,e.label)))}(),ut=function(){var e=c.ObjectUtils.isNotEmpty(rt)?Be(rt):null;f.editable&&(e=e||f.value||"");var t=p({className:"p-hidden-accessible"},W("hiddenSelectedMessage")),n=p(V({ref:q,id:f.inputId,defaultValue:e,type:"text",readOnly:!0,"aria-haspopup":"listbox",onFocus:oe,onBlur:le,onKeyDown:ae,disabled:f.disabled,tabIndex:f.disabled?-1:f.tabIndex||0},it),W("input"));return y.createElement("div",t,y.createElement("input",n))}(),ct=function(){var e=c.ObjectUtils.isNotEmpty(rt)?Be(rt):null;if(f.editable){var t=p(V({ref:A,type:"text",defaultValue:e||f.value||"",className:$("input",{label:e}),disabled:f.disabled,placeholder:f.placeholder,maxLength:f.maxLength,onInput:Ce,onFocus:ke,onKeyDown:ae,onBlur:le,tabIndex:f.disabled?-1:f.tabIndex||0,"aria-haspopup":"listbox"},it),W("input"));return y.createElement("input",t)}var n=f.valueTemplate?c.ObjectUtils.getJSXElement(f.valueTemplate,rt,f):e||f.placeholder||"empty",r=p({ref:A,className:$("input",{label:e}),tabIndex:"-1"},W("input"));return y.createElement("span",r,n)}(),st=f.loading?($e=p({className:$("loadingIcon"),"data-pr-overlay-visible":N},W("loadingIcon")),Ye=c.IconUtils.getJSXIcon(f.loadingIcon||y.createElement(l.SpinnerIcon,{spin:!0}),V({},$e),{props:f}),Qe=f.placeholder||f.ariaLabel,et=p({className:$("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":N,"aria-label":Qe},W("trigger")),y.createElement("div",et,Ye)):function(){var e=p({className:$("dropdownIcon"),"data-pr-overlay-visible":N},W("dropdownIcon")),t=c.IconUtils.getJSXIcon(f.dropdownIcon||y.createElement(o.ChevronDownIcon,e),V({},e),{props:f}),n=f.placeholder||f.ariaLabel,r=p({className:$("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":N,"aria-label":n},W("trigger"));return y.createElement("div",r,t)}(),pt=function(){if(null!=f.value&&f.showClear&&!f.disabled){var e=p({className:$("clearIcon"),onPointerUp:Pe,tabIndex:f.tabIndex||"0",onKeyDown:tt,"aria-label":t.localeOption("clear")},W("clearIcon"));return c.IconUtils.getJSXIcon(f.clearIcon||y.createElement(i.TimesIcon,e),V({},e),{props:f})}return null}(),dt=p({id:f.id,ref:U,className:c.classNames(f.className,$("root",{context:d,focusedState:h,overlayVisibleState:N})),style:f.style,onClick:function(e){return t=e,void(f.disabled||f.loading||(f.onClick&&f.onClick(t),t.defaultPrevented||re(t)||"INPUT"===t.target.tagName||(R.current&&R.current&&R.current.contains(t.target)||(c.DomHandler.focus(q.current),N?Ae():Ge()),P.current=!0)));var t},onMouseDown:f.onMouseDown,onContextMenu:f.onContextMenu,onFocus:function(){f.editable&&!N&&!1===P.current&&c.DomHandler.focus(A.current)},"data-p-disabled":f.disabled,"data-p-focus":h},lt,W("root")),ft=p({ref:T,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===q.current?c.DomHandler.getFirstFocusableElement(R.current,':not([data-p-hidden-focusable="true"])'):q.current;c.DomHandler.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},W("hiddenFirstFocusableEl")),mt=p({ref:G,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===q.current?c.DomHandler.getLastFocusableElement(R.current,':not([data-p-hidden-focusable="true"])'):q.current;c.DomHandler.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},W("hiddenLastFocusableEl"));return y.createElement(y.Fragment,null,y.createElement("div",dt,ut,at,ct,pt,st,y.createElement(M,O({hostName:"Dropdown",ref:R,visibleOptions:nt,virtualScrollerRef:K},f,{appendTo:z,cx:$,filterValue:v,focusedOptionIndex:D,getOptionGroupChildren:ze,getOptionGroupLabel:function(e){return c.ObjectUtils.resolveFieldData(e,f.optionGroupLabel)},getOptionGroupRenderKey:function(e){return c.ObjectUtils.resolveFieldData(e,f.optionGroupLabel)},getOptionLabel:Be,getOptionRenderKey:function(e){return f.dataKey?c.ObjectUtils.resolveFieldData(e,f.dataKey):Be(e)},getSelectedOptionIndex:Re,hasFilter:X,in:N,isOptionDisabled:Xe,isSelected:He,onClick:function(e){a.OverlayService.emit("overlay-click",{originalEvent:e,target:U.current})},onEnter:function(e){c.ZIndexUtils.set("overlay",R.current,d&&d.autoZIndex||w.default.autoZIndex,d&&d.zIndex.overlay||w.default.zIndex.overlay),c.DomHandler.addStyles(R.current,{position:"absolute",top:"0",left:"0"}),qe(),e&&e()},onEntered:function(e){e&&e(),ee(),f.onShow&&f.onShow()},onExit:function(){te()},onExited:function(){f.filter&&f.resetFilterOnHide&&Le(),c.ZIndexUtils.clear(R.current),f.onHide&&f.onHide()},onFilterClearIconClick:function(e){Le(e)},onFilterInputChange:function(e){var t=e.target.value;b(t),f.onFilter&&f.onFilter({originalEvent:e,filter:t})},onFilterInputKeyDown:function(e){switch(e.code){case"ArrowDown":he(e);break;case"ArrowUp":ye(e);break;case"ArrowLeft":case"ArrowRight":we(e,!0);break;case"Escape":case"Enter":case"NumpadEnter":De(e),e.preventDefault()}},onOptionClick:function(e){e.option.disabled||(Ue(e),c.DomHandler.focus(q.current)),Ae()},ptm:W,resetFilter:Le,changeFocusedOptionIndex:ge,firstFocusableElement:y.createElement("span",ft),lastFocusableElement:y.createElement("span",mt),sx:Y}))),ot&&y.createElement(u.Tooltip,O({target:U,content:f.tooltip,pt:W("tooltip")},f.tooltipOptions)))})));K.displayName="Dropdown",exports.Dropdown=K;
|
package/dropdown/dropdown.esm.js
CHANGED
|
@@ -386,7 +386,7 @@ var DropdownItem = /*#__PURE__*/React.memo(function (props) {
|
|
|
386
386
|
if (selected) {
|
|
387
387
|
var checkIconProps = mergeProps({
|
|
388
388
|
className: cx('checkIcon')
|
|
389
|
-
}, getPTOptions('
|
|
389
|
+
}, getPTOptions('checkIcon'));
|
|
390
390
|
return /*#__PURE__*/React.createElement(CheckIcon, checkIconProps);
|
|
391
391
|
}
|
|
392
392
|
var blankIconProps = mergeProps({
|
|
@@ -473,7 +473,7 @@ var DropdownPanel = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(funct
|
|
|
473
473
|
height: scrollerOptions.props ? scrollerOptions.props.itemSize : undefined
|
|
474
474
|
};
|
|
475
475
|
style = _objectSpread$1(_objectSpread$1({}, style), option.style);
|
|
476
|
-
if (option.group && props.optionGroupLabel) {
|
|
476
|
+
if (option.group && option.optionGroup && props.optionGroupLabel) {
|
|
477
477
|
var optionGroupLabel = props.optionGroupLabel;
|
|
478
478
|
var groupContent = props.optionGroupTemplate ? ObjectUtils.getJSXElement(props.optionGroupTemplate, option, index) : props.getOptionGroupLabel(option);
|
|
479
479
|
var key = index + '_' + props.getOptionGroupRenderKey(option);
|
|
@@ -1347,7 +1347,7 @@ var Dropdown = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (
|
|
|
1347
1347
|
}
|
|
1348
1348
|
};
|
|
1349
1349
|
var getOptionLabel = function getOptionLabel(option) {
|
|
1350
|
-
return props.optionLabel ? ObjectUtils.resolveFieldData(option, props.optionLabel) : ObjectUtils.resolveFieldData(option, 'label');
|
|
1350
|
+
return props.optionLabel ? ObjectUtils.resolveFieldData(option, props.optionLabel) : ObjectUtils.resolveFieldData(option, 'label') || option;
|
|
1351
1351
|
};
|
|
1352
1352
|
var getOptionValue = function getOptionValue(option) {
|
|
1353
1353
|
return props.optionValue ? ObjectUtils.resolveFieldData(option, props.optionValue) : ObjectUtils.resolveFieldData(option, 'value') || option;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import t,{PrimeReactContext as n,localeOption as r,FilterService as o}from"primereact/api";import{ComponentBase as l,useHandleStyle as i}from"primereact/componentbase";import{useMergeProps as a,useOverlayListener as u,useMountEffect as c,useUpdateEffect as p,useUnmountEffect as s}from"primereact/hooks";import{ChevronDownIcon as d}from"primereact/icons/chevrondown";import{SpinnerIcon as f}from"primereact/icons/spinner";import{TimesIcon as m}from"primereact/icons/times";import{OverlayService as v}from"primereact/overlayservice";import{Tooltip as b}from"primereact/tooltip";import{classNames as g,ObjectUtils as h,DomHandler as y,IconUtils as w,ZIndexUtils as E}from"primereact/utils";import{CSSTransition as I}from"primereact/csstransition";import{SearchIcon as O}from"primereact/icons/search";import{Portal as x}from"primereact/portal";import{VirtualScroller as S}from"primereact/virtualscroller";import{Ripple as F}from"primereact/ripple";import{CheckIcon as k}from"primereact/icons/check";import{IconBase as C}from"primereact/iconbase";function D(){return D=Object.assign?Object.assign.bind():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},D.apply(this,arguments)}function N(e){return N="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},N(e)}function L(e,t){if("object"!==N(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function P(e){var t=L(e,"string");return"symbol"===N(t)?t:String(t)}function R(e,t,n){return(t=P(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T(e){if(Array.isArray(e))return e}function j(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,l,i,a=[],u=!0,c=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=l.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return a}}function M(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 G(e,t){if(e){if("string"==typeof e)return M(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)?M(e,t):void 0}}function A(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function K(e,t){return T(e)||j(e,t)||G(e,t)||A()}var V=l.extend({defaultProps:{__TYPE:"Dropdown",__parentMetadata:null,appendTo:null,ariaLabel:null,ariaLabelledBy:null,autoFocus:!1,children:void 0,className:null,clearIcon:null,dataKey:null,disabled:!1,dropdownIcon:null,editable:!1,emptyFilterMessage:null,highlightOnSelect:!0,checkmark:!1,emptyMessage:null,filter:!1,filterBy:null,filterClearIcon:null,filterIcon:null,filterInputAutoFocus:!1,filterLocale:void 0,filterMatchMode:"contains",filterPlaceholder:null,filterTemplate:null,focusInputRef:null,id:null,inputId:null,inputRef:null,invalid:!1,variant:null,itemTemplate:null,loading:!1,loadingIcon:null,maxLength:null,name:null,onBlur:null,onChange:null,onContextMenu:null,onFilter:null,onFocus:null,onHide:null,onMouseDown:null,onShow:null,optionDisabled:null,optionGroupChildren:"items",selectOnFocus:!1,focusOnHover:!0,autoOptionFocus:!1,optionGroupLabel:null,optionGroupTemplate:null,optionLabel:null,optionValue:null,options:null,panelClassName:null,panelFooterTemplate:null,panelStyle:null,placeholder:null,required:!1,resetFilterOnHide:!1,scrollHeight:"200px",showClear:!1,showFilterClear:!1,showOnFocus:!1,style:null,tabIndex:null,tooltip:null,tooltipOptions:null,transitionOptions:null,value:null,valueTemplate:null,virtualScrollerOptions:null},css:{classes:{root:function(e){var t=e.props,n=e.focusedState,r=e.overlayVisibleState,o=e.context;return g("p-dropdown p-component p-inputwrapper",{"p-disabled":t.disabled,"p-invalid":t.invalid,"p-focus":n,"p-variant-filled":t.variant?"filled"===t.variant:o&&"filled"===o.inputStyle,"p-dropdown-clearable":t.showClear&&!t.disabled,"p-inputwrapper-filled":h.isNotEmpty(t.value),"p-inputwrapper-focus":n||r})},input:function(e){var t=e.props,n=e.label;return t.editable?"p-dropdown-label p-inputtext":g("p-dropdown-label p-inputtext",{"p-placeholder":null===n&&t.placeholder,"p-dropdown-label-empty":null===n&&!t.placeholder})},trigger:"p-dropdown-trigger",emptyMessage:"p-dropdown-empty-message",itemGroup:function(e){var t=e.optionGroupLabel;return g("p-dropdown-item-group",{"p-dropdown-item-empty":!t||0===t.length})},itemGroupLabel:"p-dropdown-item-group-label",dropdownIcon:"p-dropdown-trigger-icon p-clickable",loadingIcon:"p-dropdown-trigger-icon p-clickable",clearIcon:"p-dropdown-clear-icon p-clickable",filterIcon:"p-dropdown-filter-icon",filterClearIcon:"p-dropdown-filter-clear-icon",filterContainer:function(e){return g("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!e.clearIcon})},filterInput:function(e){var t=e.props,n=e.context;return g("p-dropdown-filter p-inputtext p-component",{"p-variant-filled":t.variant?"filled"===t.variant:n&&"filled"===n.inputStyle})},list:function(e){return"p-dropdown-items"},panel:function(e){var n=e.context;return g("p-dropdown-panel p-component",{"p-input-filled":n&&"filled"===n.inputStyle||"filled"===t.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===t.ripple})},item:function(e){var t=e.label;return g("p-dropdown-item",{"p-highlight":e.selected&&e.highlightOnSelect,"p-disabled":e.disabled,"p-focus":e.index===e.focusedOptionIndex,"p-dropdown-item-empty":!t||0===t.length})},itemLabel:"p-dropdown-item-label",checkIcon:"p-dropdown-check-icon",blankIcon:"p-dropdown-blank-icon",wrapper:"p-dropdown-items-wrapper",header:"p-dropdown-header",footer:"p-dropdown-footer",transition:"p-connected-overlay"},styles:"\n@layer primereact {\n .p-dropdown {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n }\n \n .p-dropdown-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n \n .p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n \n .p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n }\n \n input.p-dropdown-label {\n cursor: default;\n }\n \n .p-dropdown .p-dropdown-panel {\n min-width: 100%;\n }\n \n .p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n }\n \n .p-dropdown-items-wrapper {\n overflow: auto;\n }\n \n .p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n }\n \n .p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n \n .p-dropdown-filter {\n width: 100%;\n }\n \n .p-dropdown-filter-container {\n position: relative;\n }\n \n .p-dropdown-clear-icon,\n .p-dropdown-filter-icon,\n .p-dropdown-filter-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-fluid .p-dropdown {\n display: flex;\n }\n \n .p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n }\n}\n",inlineStyles:{wrapper:function(e){return{maxHeight:e.props.scrollHeight||"auto"}},panel:function(e){}}}}),H=e.memo(e.forwardRef((function(t,n){var r=C.getPTI(t);return e.createElement("svg",D({ref:n,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r),e.createElement("rect",{width:"1",height:"1",fill:"currentColor",fillOpacity:"0"}))})));H.displayName="BlankIcon";var B=e.memo((function(t){var n=a(),r=t.ptm,o=t.cx,l=t.selected,i=t.disabled,u=t.option,c=t.label,p=t.index,s=t.focusedOptionIndex,d=t.checkmark,f=t.highlightOnSelect,m=function(e){return r(e,{context:{selected:l,disabled:i}})},v=t.template?h.getJSXElement(t.template,t.option):t.label,b=n({role:"option",key:t.label,className:g(u.className,o("item",{selected:l,disabled:i,label:c,index:p,focusedOptionIndex:s,highlightOnSelect:f})),style:t.style,onClick:function(e){return n=e,void(t.onClick&&t.onClick({originalEvent:n,option:u}));var n},onMouseMove:function(e){return null==t?void 0:t.onMouseMove(e,p)},"aria-label":c,"aria-selected":l,"data-p-highlight":l,"data-p-focused":s===p,"data-p-disabled":i},m("item")),y=n({className:o("itemLabel")},m("itemLabel"));return e.createElement("li",b,d&&function(){if(l){var t=n({className:o("checkIcon")},m("checIcon"));return e.createElement(k,t)}var r=n({className:o("blankIcon")},m("blankIcon"));return e.createElement(H,r)}(),e.createElement("span",y,v),e.createElement(F,null))}));function J(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 X(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}B.displayName="DropdownItem";var _=e.memo(e.forwardRef((function(t,o){var l,i,u,c,p,s=a(),d=t.ptm,f=t.cx,v=t.sx,b=e.useContext(n),E=e.useRef(null),F=!(t.visibleOptions&&t.visibleOptions.length)&&t.hasFilter,k={filter:function(e){return P(e)},reset:function(){return t.resetFilter()}},C=function(e,n){return d(e,X({hostName:t.hostName},n))},N=function(){t.onEnter((function(){if(t.virtualScrollerRef.current){var e=t.getSelectedOptionIndex();-1!==e&&setTimeout((function(){return t.virtualScrollerRef.current.scrollToIndex(e)}),0)}}))},L=function(){t.onEntered((function(){t.filter&&t.filterInputAutoFocus&&y.focus(E.current,!1)}))},P=function(e){t.virtualScrollerRef.current&&t.virtualScrollerRef.current.scrollToIndex(0),t.onFilterInputChange&&t.onFilterInputChange(e)},R=function(){if(t.panelFooterTemplate){var n=h.getJSXElement(t.panelFooterTemplate,t,t.onOverlayHide),r=s({className:f("footer")},C("footer"));return e.createElement("div",r,n)}return null},T=function(e,n){var r;t.focusOnHover&&(null==t||null===(r=t.changeFocusedOptionIndex)||void 0===r||r.call(t,e,n))},j=function(n,o){var l=h.getJSXElement(n,t)||r(o?"emptyFilterMessage":"emptyMessage"),i=s({className:f("emptyMessage")},C("emptyMessage"));return e.createElement("li",i,l)},M=function(n,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},l={height:o.props?o.props.itemSize:void 0};if(l=X(X({},l),n.style),n.group&&t.optionGroupLabel){var i=t.optionGroupLabel,a=t.optionGroupTemplate?h.getJSXElement(t.optionGroupTemplate,n,r):t.getOptionGroupLabel(n),u=r+"_"+t.getOptionGroupRenderKey(n),c=s({className:f("itemGroup",{optionGroupLabel:i}),style:l,"data-p-highlight":t.selected},C("itemGroup")),p=s({className:f("itemGroupLabel")},C("itemGroupLabel"));return e.createElement("li",D({key:u},c),e.createElement("span",p,a))}var m=t.getOptionRenderKey(n)+"_"+r,v=t.getOptionLabel(n),b=t.isOptionDisabled(n);return e.createElement(B,{key:m,label:v,index:r,focusedOptionIndex:t.focusedOptionIndex,option:n,style:l,template:t.itemTemplate,selected:t.isSelected(n),highlightOnSelect:t.highlightOnSelect,disabled:b,onClick:t.onOptionClick,onMouseMove:T,ptm:d,cx:f,checkmark:t.checkmark})},G=function(){if(t.showFilterClear&&t.filterValue){var n=r("clear"),o=s({className:f("filterClearIcon"),"aria-label":n,onClick:function(){return t.onFilterClearIconClick((function(){return y.focus(E.current)}))}},C("filterClearIcon"));return w.getJSXIcon(t.filterClearIcon||e.createElement(m,o),X({},o),{props:t})}return null},A=function(){if(t.filter){var n=G(),r=s({className:f("filterIcon")},C("filterIcon")),o=w.getJSXIcon(t.filterIcon||e.createElement(O,r),X({},r),{props:t}),l=s({className:f("filterContainer",{clearIcon:n})},C("filterContainer")),i=s({ref:E,type:"text",autoComplete:"off",className:f("filterInput",{context:b}),placeholder:t.filterPlaceholder,onKeyDown:t.onFilterInputKeyDown,onChange:function(e){return P(e)},value:t.filterValue},C("filterInput")),a=e.createElement("div",l,e.createElement("input",i),n,o);if(t.filterTemplate){var u={className:g("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!n}),element:a,filterOptions:k,filterInputKeyDown:t.onFilterInputKeyDown,filterInputChange:P,filterIconClassName:"p-dropdown-filter-icon",clearIcon:n,props:t};a=h.getJSXElement(t.filterTemplate,u)}var c=s({className:f("header")},C("header"));return e.createElement("div",c,a)}return null},K=function(){if(t.virtualScrollerOptions){var n=X(X({},t.virtualScrollerOptions),{style:X(X({},t.virtualScrollerOptions.style),{height:t.scrollHeight}),className:g("p-dropdown-items-wrapper",t.virtualScrollerOptions.className),items:t.visibleOptions,autoSize:!0,onLazyLoad:function(e){return t.virtualScrollerOptions.onLazyLoad(X(X({},e),{filter:t.filterValue}))},itemTemplate:function(e,t){return e&&M(e,t.index,t)},contentTemplate:function(n){var r=F?j(t.hasFilter?t.emptyFilterMessage:t.emptyMessage):n.children,o=s({ref:n.contentRef,style:n.style,className:g(n.className,f("list",{virtualScrollerProps:t.virtualScrollerOptions})),role:"listbox"},C("list"));return e.createElement("ul",o,r)}});return e.createElement(S,D({ref:t.virtualScrollerRef},n,{pt:d("virtualScroller")}))}var r=h.isNotEmpty(t.visibleOptions)?t.visibleOptions.map(M):t.hasFilter?j(t.emptyFilterMessage,!0):j(t.emptyMessage),o=s({className:f("wrapper"),style:v("wrapper")},C("wrapper")),l=s({className:f("list"),role:"listbox"},C("list"));return e.createElement("div",o,e.createElement("ul",l,r))},V=(l=A(),i=K(),u=R(),c=s({className:g(t.panelClassName,f("panel",{context:b})),style:v("panel"),onClick:t.onClick},C("panel")),p=s({classNames:f("transition"),in:t.in,timeout:{enter:120,exit:100},options:t.transitionOptions,unmountOnExit:!0,onEnter:N,onEntered:L,onExit:t.onExit,onExited:t.onExited},C("transition")),e.createElement(I,D({nodeRef:o},p),e.createElement("div",D({ref:o},c),t.firstFocusableElement,l,i,u,t.lastFocusableElement)));return e.createElement(x,{element:V,appendTo:t.appendTo})})));function U(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=q(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 l,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,l=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw l}}}}function q(e,t){if(e){if("string"==typeof e)return z(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)?z(e,t):void 0}}function z(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 W(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?W(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}_.displayName="DropdownPanel";var $=e.memo(e.forwardRef((function(l,I){var O=a(),x=e.useContext(n),S=V.getProps(l,x),F=K(e.useState(""),2),k=F[0],C=F[1],L=K(e.useState(!1),2),P=L[0],T=L[1],j=K(e.useState(-1),2),M=j[0],G=j[1],A=K(e.useState(!1),2),H=A[0],B=A[1],J=e.useRef(!1),X=e.useRef(null),q=e.useRef(null),z=e.useRef(null),W=e.useRef(null),$=e.useRef(S.inputRef),Y=e.useRef(S.focusInputRef),Q=e.useRef(null),ee=e.useRef(null),te=e.useRef(null);e.useRef(null);var ne=S.virtualScrollerOptions&&S.virtualScrollerOptions.lazy,re=h.isNotEmpty(k),oe=S.appendTo||x&&x.appendTo||t.appendTo,le=V.setMetaData(Z(Z({props:S},S.__parentMetadata),{},{state:{filter:k,focused:P,overlayVisible:H}})),ie=le.ptm,ae=le.cx,ue=le.sx;i(V.css.styles,le.isUnstyled,{name:"dropdown"});var ce=K(u({target:X,overlay:q,listener:function(e,t){t.valid&&("outside"===t.type?!fe(e)&&Ze():Ze())},when:H}),2),pe=ce[0],se=ce[1],de=function(e){return(e||[]).reduce((function(e,t,n){e.push({optionGroup:t,group:!0,index:n,code:t.code,label:t.label});var r=ot(t);return r&&r.forEach((function(t){return e.push(t)})),e}),[])},fe=function(e){return y.isAttributeEquals(e.target,"data-pc-section","clearicon")||y.isAttributeEquals(e.target.parentElement||e.target,"data-pc-section","filterclearicon")},me=function(e){S.showOnFocus&&!H&&We(),T(!0),S.onFocus&&S.onFocus(e)},ve=function(e){T(!1),S.onBlur&&setTimeout((function(){var t=$.current?$.current.value:void 0;S.onBlur({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:S.name,id:S.id,value:t}})}),200)},be=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=tt(t);Xe({originalEvent:e,option:r}),n&&Ze()},ge=function(e){if(S.disabled||y.isAndroid())e.preventDefault();else{var t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":Ce(e);break;case"ArrowUp":De(e);break;case"ArrowLeft":case"ArrowRight":Ne(e,S.editable);break;case"Home":Le(e);break;case"End":Pe(e);break;case"PageDown":Te(e);break;case"PageUp":Re(e);break;case"Space":je(e,S.editable);break;case"NumpadEnter":case"Enter":Me(e);break;case"Escape":Ge(e);break;case"Tab":Ae(e);break;case"Backspace":Ke(e,S.editable);break;case"ShiftLeft":case"ShiftRight":break;default:!t&&h.isPrintableCharacter(e.key)&&(!H&&!S.editable&&We(),!S.editable&&xe(e,e.key))}J.current=!1}},he=function(e){var t;return ye(e)&&(null===(t=et(e))||void 0===t?void 0:t.toLocaleLowerCase(S.filterLocale).startsWith(te.current.toLocaleLowerCase(S.filterLocale)))},ye=function(e){return h.isNotEmpty(e)&&!(rt(e)||nt(e))},we=function(){return h.isNotEmpty(S.value)},Ee=function(e){return ye(e)&&ze(e)},Ie=function(){return we?dt.findIndex((function(e){return Ee(e)})):-1},Oe=function(){var e=Ie();return e<0?Se():e},xe=function(e,t){te.current=(te.current||"")+t;var n=-1,r=!1;return h.isNotEmpty(te.current)&&(-1!==(n=-1!==M?-1===(n=dt.slice(M).findIndex((function(e){return he(e)})))?dt.slice(0,M).findIndex((function(e){return he(e)})):n+M:dt.findIndex((function(e){return he(e)})))&&(r=!0),-1===n&&-1===M&&(n=Oe()),-1!==n&&ke(e,n)),ee.current&&clearTimeout(ee.current),ee.current=setTimeout((function(){te.current="",ee.current=null}),500),r},Se=function(){return dt.findIndex((function(e){return ye(e)}))},Fe=function(){return h.findLastIndex(dt,(function(e){return ye(e)}))},ke=function(e,t){M!==t&&(G(t),S.selectOnFocus&&be(e,dt[t],!1))},Ce=function(e){if(H){var t=-1!==M?(r=(n=M)<dt.length-1?dt.slice(n+1).findIndex((function(e){return ye(e)})):-1)>-1?r+n+1:n:J.current?Se():Oe();ke(e,t)}else We(),S.editable&&ke(e,Ie());var n,r;e.preventDefault()},De=function(e){var t,n,r;if(e.altKey&&!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))-1!==M&&be(e,dt[M]),state.overlayVisible&&Ze(),e.preventDefault();else{var o=-1!==M?(r=(n=M)>0?h.findLastIndex(dt.slice(0,n),(function(e){return ye(e)})):-1)>-1?r:n:J.current?Fe():(t=Ie())<0?Fe():t;ke(e,o),!H&&We(),e.preventDefault()}},Ne=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&G(-1)},Le=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?(e.currentTarget.setSelectionRange(0,0),G(-1)):(ke(e,Se()),!H&&We()),e.preventDefault()},Pe=function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var t=e.currentTarget,n=t.value.length;t.setSelectionRange(n,n),G(-1)}else ke(e,Fe()),!H&&We();e.preventDefault()},Re=function(e){e.preventDefault()},Te=function(e){e.preventDefault()},je=function(e){!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&Me(e)},Me=function(e){H?(-1!==M&&be(e,dt[M]),Ze()):(G(-1),Ce(e)),e.preventDefault()},Ge=function(e){H&&Ze(),e.preventDefault()},Ae=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]||(!H||y.getFocusableElements(q.current,':not([data-p-hidden-focusable="true"])').length>0?(-1!==M&&be(e,dt[M]),H&&Ze()):(y.focus(z.current),e.preventDefault()))},Ke=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&!H&&We()},Ve=function(e){var t=null;e.target.value&&(t=dt.findIndex((function(t){return et(t).toLocaleLowerCase().startsWith(e.target.value.toLocaleLowerCase())}))),G(t),S.onChange&&S.onChange({originalEvent:e.originalEvent,value:e.target.value,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:S.name,id:S.id,value:e.target.value}})},He=function(e){T(!0),Ze(),S.onFocus&&S.onFocus(e)},Be=function(e){C(""),S.onFilter&&S.onFilter({filter:""}),e&&e()},Je=function(e){S.onChange&&S.onChange({originalEvent:e,value:void 0,stopPropagation:function(){null==e||e.stopPropagation()},preventDefault:function(){null==e||e.preventDefault()},target:{name:S.name,id:S.id,value:void 0}}),S.filter&&Be(),Qe()},Xe=function(e){if(ft!==e.option){Qe(e.option),G(-1);var t=tt(e.option),n=qe(e.option,dt);S.onChange&&S.onChange({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:S.name,id:S.id,value:t}}),ke(e.originalEvent,n)}},_e=function(e){if(e=e||dt,null!=S.value&&e){if(!S.optionGroupLabel)return qe(S.value,e);for(var t=0;t<e.length;t++){var n=qe(S.value,ot(e[t]));if(-1!==n)return{group:t,option:n}}}return-1},Ue=function(){return S.optionValue?null:S.dataKey},qe=function(e,t){var n=Ue();return t.findIndex((function(t){return h.equals(e,tt(t),n)}))},ze=function(e){return h.equals(S.value,tt(e),Ue())},We=function(){G(-1!==M?M:S.autoOptionFocus?Oe():S.editable?-1:Ie()),B(!0)},Ze=function(){B(!1),J.current=!1},$e=function(){y.alignOverlay(q.current,$.current.parentElement,S.appendTo||x&&x.appendTo||t.appendTo)},Ye=function(){var e=y.findSingle(q.current,'li[data-p-focused="true"]');if(e&&e.scrollIntoView)e.scrollIntoView({block:"nearest",inline:"nearest"});else{var t=y.findSingle(q.current,'li[data-p-highlight="true"]');t&&t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"nearest"})}},Qe=function(e){$.current&&($.current.value=e?et(e):S.value||"",Y.current&&(Y.current.value=$.current.value))},et=function(e){return h.resolveFieldData(e,S.optionLabel?S.optionLabel:"label")},tt=function(e){return S.optionValue?h.resolveFieldData(e,S.optionValue):h.resolveFieldData(e,"value")||e},nt=function(e){return S.optionGroupLabel&&e.optionGroup&&e.group},rt=function(e){return S.optionDisabled?h.isFunction(S.optionDisabled)?S.optionDisabled(e):h.resolveFieldData(e,S.optionDisabled):!(!e||void 0===e.disabled)&&e.disabled},ot=function(e){return h.resolveFieldData(e,S.optionGroupChildren)},lt=function(){if(S.editable&&$.current){var e=(ft?et(ft):null)||S.value||"";$.current.value=e,Y.current&&(Y.current.value=e)}};e.useImperativeHandle(I,(function(){return{props:S,show:We,hide:Ze,clear:Je,focus:function(){return y.focus(Y.current)},getElement:function(){return X.current},getOverlay:function(){return q.current},getInput:function(){return $.current},getFocusInput:function(){return Y.current},getVirtualScroller:function(){return Q.current}}})),e.useEffect((function(){h.combinedRefs($,S.inputRef),h.combinedRefs(Y,S.focusInputRef)}),[$,S.inputRef,Y,S.focusInputRef]),c((function(){S.autoFocus&&y.focus(Y.current,S.autoFocus),$e()})),p((function(){H&&(S.value||M>=0)&&Ye()}),[H,S.value,M]),p((function(){H&&k&&S.filter&&$e()}),[H,k,S.filter]),p((function(){!k||S.options&&0!==S.options.length||C(""),lt(),$.current&&($.current.selectedIndex=1)})),s((function(){E.clear(q.current)}));var it,at,ut,ct,pt,st=function(e){"Enter"!==e.key&&"Space"!==e.code||(Je(e),e.preventDefault())},dt=function(){var e=S.optionGroupLabel?de(S.options):S.options;if(re&&!ne){var t=k.trim().toLocaleLowerCase(S.filterLocale),n=S.filterBy?S.filterBy.split(","):[S.optionLabel||"label"];if(S.optionGroupLabel){var r,l=[],i=U(S.options);try{for(i.s();!(r=i.n()).done;){var a=r.value,u=o.filter(ot(a),n,t,S.filterMatchMode,S.filterLocale);u&&u.length&&l.push(Z(Z({},a),R({},"".concat(S.optionGroupChildren),u)))}}catch(e){i.e(e)}finally{i.f()}return de(l)}return o.filter(e,n,t,S.filterMatchMode,S.filterLocale)}return e}(),ft=-1!==(it=_e(S.options))?S.optionGroupLabel?ot(S.options[it.group])[it.option]:S.options[it]:null,mt=h.isNotEmpty(S.tooltip),vt=V.getOtherProps(S),bt=h.reduceKeys(vt,y.ARIA_PROPS),gt=function(){var t={value:"",label:S.placeholder};if(ft){var n=tt(ft);t={value:"object"===N(n)?S.options.findIndex((function(e){return e===n})):n,label:et(ft)}}var r=O({className:"p-hidden-accessible p-dropdown-hidden-select"},ie("hiddenSelectedMessage")),o=O({ref:$,required:S.required,defaultValue:t.value,name:S.name,tabIndex:-1,"aria-hidden":"true"},ie("select")),l=O({value:t.value},ie("option"));return e.createElement("div",r,e.createElement("select",o,e.createElement("option",l,t.label)))}(),ht=function(){var t=h.isNotEmpty(ft)?et(ft):null;S.editable&&(t=t||S.value||"");var n=O({className:"p-hidden-accessible"},ie("hiddenSelectedMessage")),r=O(Z({ref:Y,id:S.inputId,defaultValue:t,type:"text",readOnly:!0,"aria-haspopup":"listbox",onFocus:me,onBlur:ve,onKeyDown:ge,disabled:S.disabled,tabIndex:S.disabled?-1:S.tabIndex||0},bt),ie("input"));return e.createElement("div",n,e.createElement("input",r))}(),yt=function(){var t=h.isNotEmpty(ft)?et(ft):null;if(S.editable){var n=O(Z({ref:$,type:"text",defaultValue:t||S.value||"",className:ae("input",{label:t}),disabled:S.disabled,placeholder:S.placeholder,maxLength:S.maxLength,onInput:Ve,onFocus:He,onKeyDown:ge,onBlur:ve,tabIndex:S.disabled?-1:S.tabIndex||0,"aria-haspopup":"listbox"},bt),ie("input"));return e.createElement("input",n)}var r=S.valueTemplate?h.getJSXElement(S.valueTemplate,ft,S):t||S.placeholder||"empty",o=O({ref:$,className:ae("input",{label:t}),tabIndex:"-1"},ie("input"));return e.createElement("span",o,r)}(),wt=S.loading?(at=O({className:ae("loadingIcon"),"data-pr-overlay-visible":H},ie("loadingIcon")),ut=w.getJSXIcon(S.loadingIcon||e.createElement(f,{spin:!0}),Z({},at),{props:S}),ct=S.placeholder||S.ariaLabel,pt=O({className:ae("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":H,"aria-label":ct},ie("trigger")),e.createElement("div",pt,ut)):function(){var t=O({className:ae("dropdownIcon"),"data-pr-overlay-visible":H},ie("dropdownIcon")),n=w.getJSXIcon(S.dropdownIcon||e.createElement(d,t),Z({},t),{props:S}),r=S.placeholder||S.ariaLabel,o=O({className:ae("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":H,"aria-label":r},ie("trigger"));return e.createElement("div",o,n)}(),Et=function(){if(null!=S.value&&S.showClear&&!S.disabled){var t=O({className:ae("clearIcon"),onPointerUp:Je,tabIndex:S.tabIndex||"0",onKeyDown:st,"aria-label":r("clear")},ie("clearIcon"));return w.getJSXIcon(S.clearIcon||e.createElement(m,t),Z({},t),{props:S})}return null}(),It=O({id:S.id,ref:X,className:g(S.className,ae("root",{context:x,focusedState:P,overlayVisibleState:H})),style:S.style,onClick:function(e){return t=e,void(S.disabled||S.loading||(S.onClick&&S.onClick(t),t.defaultPrevented||fe(t)||"INPUT"===t.target.tagName||(q.current&&q.current&&q.current.contains(t.target)||(y.focus(Y.current),H?Ze():We()),J.current=!0)));var t},onMouseDown:S.onMouseDown,onContextMenu:S.onContextMenu,onFocus:function(){S.editable&&!H&&!1===J.current&&y.focus($.current)},"data-p-disabled":S.disabled,"data-p-focus":P},vt,ie("root")),Ot=O({ref:z,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===Y.current?y.getFirstFocusableElement(q.current,':not([data-p-hidden-focusable="true"])'):Y.current;y.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},ie("hiddenFirstFocusableEl")),xt=O({ref:W,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===Y.current?y.getLastFocusableElement(q.current,':not([data-p-hidden-focusable="true"])'):Y.current;y.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},ie("hiddenLastFocusableEl"));return e.createElement(e.Fragment,null,e.createElement("div",It,ht,gt,yt,Et,wt,e.createElement(_,D({hostName:"Dropdown",ref:q,visibleOptions:dt,virtualScrollerRef:Q},S,{appendTo:oe,cx:ae,filterValue:k,focusedOptionIndex:M,getOptionGroupChildren:ot,getOptionGroupLabel:function(e){return h.resolveFieldData(e,S.optionGroupLabel)},getOptionGroupRenderKey:function(e){return h.resolveFieldData(e,S.optionGroupLabel)},getOptionLabel:et,getOptionRenderKey:function(e){return S.dataKey?h.resolveFieldData(e,S.dataKey):et(e)},getSelectedOptionIndex:_e,hasFilter:re,in:H,isOptionDisabled:rt,isSelected:ze,onClick:function(e){v.emit("overlay-click",{originalEvent:e,target:X.current})},onEnter:function(e){E.set("overlay",q.current,x&&x.autoZIndex||t.autoZIndex,x&&x.zIndex.overlay||t.zIndex.overlay),y.addStyles(q.current,{position:"absolute",top:"0",left:"0"}),$e(),e&&e()},onEntered:function(e){e&&e(),pe(),S.onShow&&S.onShow()},onExit:function(){se()},onExited:function(){S.filter&&S.resetFilterOnHide&&Be(),E.clear(q.current),S.onHide&&S.onHide()},onFilterClearIconClick:function(e){Be(e)},onFilterInputChange:function(e){var t=e.target.value;C(t),S.onFilter&&S.onFilter({originalEvent:e,filter:t})},onFilterInputKeyDown:function(e){switch(e.code){case"ArrowDown":Ce(e);break;case"ArrowUp":De(e);break;case"ArrowLeft":case"ArrowRight":Ne(e,!0);break;case"Escape":case"Enter":case"NumpadEnter":Me(e),e.preventDefault()}},onOptionClick:function(e){e.option.disabled||(Xe(e),y.focus(Y.current)),Ze()},ptm:ie,resetFilter:Be,changeFocusedOptionIndex:ke,firstFocusableElement:e.createElement("span",Ot),lastFocusableElement:e.createElement("span",xt),sx:ue}))),mt&&e.createElement(b,D({target:X,content:S.tooltip,pt:ie("tooltip")},S.tooltipOptions)))})));$.displayName="Dropdown";export{$ as Dropdown};
|
|
1
|
+
import*as e from"react";import t,{PrimeReactContext as n,localeOption as r,FilterService as o}from"primereact/api";import{ComponentBase as l,useHandleStyle as i}from"primereact/componentbase";import{useMergeProps as a,useOverlayListener as u,useMountEffect as c,useUpdateEffect as p,useUnmountEffect as s}from"primereact/hooks";import{ChevronDownIcon as d}from"primereact/icons/chevrondown";import{SpinnerIcon as f}from"primereact/icons/spinner";import{TimesIcon as m}from"primereact/icons/times";import{OverlayService as v}from"primereact/overlayservice";import{Tooltip as b}from"primereact/tooltip";import{classNames as g,ObjectUtils as h,DomHandler as y,IconUtils as w,ZIndexUtils as E}from"primereact/utils";import{CSSTransition as I}from"primereact/csstransition";import{SearchIcon as O}from"primereact/icons/search";import{Portal as x}from"primereact/portal";import{VirtualScroller as S}from"primereact/virtualscroller";import{Ripple as F}from"primereact/ripple";import{CheckIcon as k}from"primereact/icons/check";import{IconBase as D}from"primereact/iconbase";function C(){return C=Object.assign?Object.assign.bind():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},C.apply(this,arguments)}function N(e){return N="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},N(e)}function L(e,t){if("object"!==N(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function P(e){var t=L(e,"string");return"symbol"===N(t)?t:String(t)}function R(e,t,n){return(t=P(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T(e){if(Array.isArray(e))return e}function j(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,l,i,a=[],u=!0,c=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=l.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return a}}function M(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 G(e,t){if(e){if("string"==typeof e)return M(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)?M(e,t):void 0}}function A(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function K(e,t){return T(e)||j(e,t)||G(e,t)||A()}var V=l.extend({defaultProps:{__TYPE:"Dropdown",__parentMetadata:null,appendTo:null,ariaLabel:null,ariaLabelledBy:null,autoFocus:!1,children:void 0,className:null,clearIcon:null,dataKey:null,disabled:!1,dropdownIcon:null,editable:!1,emptyFilterMessage:null,highlightOnSelect:!0,checkmark:!1,emptyMessage:null,filter:!1,filterBy:null,filterClearIcon:null,filterIcon:null,filterInputAutoFocus:!1,filterLocale:void 0,filterMatchMode:"contains",filterPlaceholder:null,filterTemplate:null,focusInputRef:null,id:null,inputId:null,inputRef:null,invalid:!1,variant:null,itemTemplate:null,loading:!1,loadingIcon:null,maxLength:null,name:null,onBlur:null,onChange:null,onContextMenu:null,onFilter:null,onFocus:null,onHide:null,onMouseDown:null,onShow:null,optionDisabled:null,optionGroupChildren:"items",selectOnFocus:!1,focusOnHover:!0,autoOptionFocus:!1,optionGroupLabel:null,optionGroupTemplate:null,optionLabel:null,optionValue:null,options:null,panelClassName:null,panelFooterTemplate:null,panelStyle:null,placeholder:null,required:!1,resetFilterOnHide:!1,scrollHeight:"200px",showClear:!1,showFilterClear:!1,showOnFocus:!1,style:null,tabIndex:null,tooltip:null,tooltipOptions:null,transitionOptions:null,value:null,valueTemplate:null,virtualScrollerOptions:null},css:{classes:{root:function(e){var t=e.props,n=e.focusedState,r=e.overlayVisibleState,o=e.context;return g("p-dropdown p-component p-inputwrapper",{"p-disabled":t.disabled,"p-invalid":t.invalid,"p-focus":n,"p-variant-filled":t.variant?"filled"===t.variant:o&&"filled"===o.inputStyle,"p-dropdown-clearable":t.showClear&&!t.disabled,"p-inputwrapper-filled":h.isNotEmpty(t.value),"p-inputwrapper-focus":n||r})},input:function(e){var t=e.props,n=e.label;return t.editable?"p-dropdown-label p-inputtext":g("p-dropdown-label p-inputtext",{"p-placeholder":null===n&&t.placeholder,"p-dropdown-label-empty":null===n&&!t.placeholder})},trigger:"p-dropdown-trigger",emptyMessage:"p-dropdown-empty-message",itemGroup:function(e){var t=e.optionGroupLabel;return g("p-dropdown-item-group",{"p-dropdown-item-empty":!t||0===t.length})},itemGroupLabel:"p-dropdown-item-group-label",dropdownIcon:"p-dropdown-trigger-icon p-clickable",loadingIcon:"p-dropdown-trigger-icon p-clickable",clearIcon:"p-dropdown-clear-icon p-clickable",filterIcon:"p-dropdown-filter-icon",filterClearIcon:"p-dropdown-filter-clear-icon",filterContainer:function(e){return g("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!e.clearIcon})},filterInput:function(e){var t=e.props,n=e.context;return g("p-dropdown-filter p-inputtext p-component",{"p-variant-filled":t.variant?"filled"===t.variant:n&&"filled"===n.inputStyle})},list:function(e){return"p-dropdown-items"},panel:function(e){var n=e.context;return g("p-dropdown-panel p-component",{"p-input-filled":n&&"filled"===n.inputStyle||"filled"===t.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===t.ripple})},item:function(e){var t=e.label;return g("p-dropdown-item",{"p-highlight":e.selected&&e.highlightOnSelect,"p-disabled":e.disabled,"p-focus":e.index===e.focusedOptionIndex,"p-dropdown-item-empty":!t||0===t.length})},itemLabel:"p-dropdown-item-label",checkIcon:"p-dropdown-check-icon",blankIcon:"p-dropdown-blank-icon",wrapper:"p-dropdown-items-wrapper",header:"p-dropdown-header",footer:"p-dropdown-footer",transition:"p-connected-overlay"},styles:"\n@layer primereact {\n .p-dropdown {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n }\n \n .p-dropdown-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n \n .p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n \n .p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n }\n \n input.p-dropdown-label {\n cursor: default;\n }\n \n .p-dropdown .p-dropdown-panel {\n min-width: 100%;\n }\n \n .p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n }\n \n .p-dropdown-items-wrapper {\n overflow: auto;\n }\n \n .p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n }\n \n .p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n \n .p-dropdown-filter {\n width: 100%;\n }\n \n .p-dropdown-filter-container {\n position: relative;\n }\n \n .p-dropdown-clear-icon,\n .p-dropdown-filter-icon,\n .p-dropdown-filter-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-fluid .p-dropdown {\n display: flex;\n }\n \n .p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n }\n}\n",inlineStyles:{wrapper:function(e){return{maxHeight:e.props.scrollHeight||"auto"}},panel:function(e){}}}}),H=e.memo(e.forwardRef((function(t,n){var r=D.getPTI(t);return e.createElement("svg",C({ref:n,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r),e.createElement("rect",{width:"1",height:"1",fill:"currentColor",fillOpacity:"0"}))})));H.displayName="BlankIcon";var B=e.memo((function(t){var n=a(),r=t.ptm,o=t.cx,l=t.selected,i=t.disabled,u=t.option,c=t.label,p=t.index,s=t.focusedOptionIndex,d=t.checkmark,f=t.highlightOnSelect,m=function(e){return r(e,{context:{selected:l,disabled:i}})},v=t.template?h.getJSXElement(t.template,t.option):t.label,b=n({role:"option",key:t.label,className:g(u.className,o("item",{selected:l,disabled:i,label:c,index:p,focusedOptionIndex:s,highlightOnSelect:f})),style:t.style,onClick:function(e){return n=e,void(t.onClick&&t.onClick({originalEvent:n,option:u}));var n},onMouseMove:function(e){return null==t?void 0:t.onMouseMove(e,p)},"aria-label":c,"aria-selected":l,"data-p-highlight":l,"data-p-focused":s===p,"data-p-disabled":i},m("item")),y=n({className:o("itemLabel")},m("itemLabel"));return e.createElement("li",b,d&&function(){if(l){var t=n({className:o("checkIcon")},m("checkIcon"));return e.createElement(k,t)}var r=n({className:o("blankIcon")},m("blankIcon"));return e.createElement(H,r)}(),e.createElement("span",y,v),e.createElement(F,null))}));function J(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 X(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}B.displayName="DropdownItem";var _=e.memo(e.forwardRef((function(t,o){var l,i,u,c,p,s=a(),d=t.ptm,f=t.cx,v=t.sx,b=e.useContext(n),E=e.useRef(null),F=!(t.visibleOptions&&t.visibleOptions.length)&&t.hasFilter,k={filter:function(e){return P(e)},reset:function(){return t.resetFilter()}},D=function(e,n){return d(e,X({hostName:t.hostName},n))},N=function(){t.onEnter((function(){if(t.virtualScrollerRef.current){var e=t.getSelectedOptionIndex();-1!==e&&setTimeout((function(){return t.virtualScrollerRef.current.scrollToIndex(e)}),0)}}))},L=function(){t.onEntered((function(){t.filter&&t.filterInputAutoFocus&&y.focus(E.current,!1)}))},P=function(e){t.virtualScrollerRef.current&&t.virtualScrollerRef.current.scrollToIndex(0),t.onFilterInputChange&&t.onFilterInputChange(e)},R=function(){if(t.panelFooterTemplate){var n=h.getJSXElement(t.panelFooterTemplate,t,t.onOverlayHide),r=s({className:f("footer")},D("footer"));return e.createElement("div",r,n)}return null},T=function(e,n){var r;t.focusOnHover&&(null==t||null===(r=t.changeFocusedOptionIndex)||void 0===r||r.call(t,e,n))},j=function(n,o){var l=h.getJSXElement(n,t)||r(o?"emptyFilterMessage":"emptyMessage"),i=s({className:f("emptyMessage")},D("emptyMessage"));return e.createElement("li",i,l)},M=function(n,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},l={height:o.props?o.props.itemSize:void 0};if(l=X(X({},l),n.style),n.group&&n.optionGroup&&t.optionGroupLabel){var i=t.optionGroupLabel,a=t.optionGroupTemplate?h.getJSXElement(t.optionGroupTemplate,n,r):t.getOptionGroupLabel(n),u=r+"_"+t.getOptionGroupRenderKey(n),c=s({className:f("itemGroup",{optionGroupLabel:i}),style:l,"data-p-highlight":t.selected},D("itemGroup")),p=s({className:f("itemGroupLabel")},D("itemGroupLabel"));return e.createElement("li",C({key:u},c),e.createElement("span",p,a))}var m=t.getOptionRenderKey(n)+"_"+r,v=t.getOptionLabel(n),b=t.isOptionDisabled(n);return e.createElement(B,{key:m,label:v,index:r,focusedOptionIndex:t.focusedOptionIndex,option:n,style:l,template:t.itemTemplate,selected:t.isSelected(n),highlightOnSelect:t.highlightOnSelect,disabled:b,onClick:t.onOptionClick,onMouseMove:T,ptm:d,cx:f,checkmark:t.checkmark})},G=function(){if(t.showFilterClear&&t.filterValue){var n=r("clear"),o=s({className:f("filterClearIcon"),"aria-label":n,onClick:function(){return t.onFilterClearIconClick((function(){return y.focus(E.current)}))}},D("filterClearIcon"));return w.getJSXIcon(t.filterClearIcon||e.createElement(m,o),X({},o),{props:t})}return null},A=function(){if(t.filter){var n=G(),r=s({className:f("filterIcon")},D("filterIcon")),o=w.getJSXIcon(t.filterIcon||e.createElement(O,r),X({},r),{props:t}),l=s({className:f("filterContainer",{clearIcon:n})},D("filterContainer")),i=s({ref:E,type:"text",autoComplete:"off",className:f("filterInput",{context:b}),placeholder:t.filterPlaceholder,onKeyDown:t.onFilterInputKeyDown,onChange:function(e){return P(e)},value:t.filterValue},D("filterInput")),a=e.createElement("div",l,e.createElement("input",i),n,o);if(t.filterTemplate){var u={className:g("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!n}),element:a,filterOptions:k,filterInputKeyDown:t.onFilterInputKeyDown,filterInputChange:P,filterIconClassName:"p-dropdown-filter-icon",clearIcon:n,props:t};a=h.getJSXElement(t.filterTemplate,u)}var c=s({className:f("header")},D("header"));return e.createElement("div",c,a)}return null},K=function(){if(t.virtualScrollerOptions){var n=X(X({},t.virtualScrollerOptions),{style:X(X({},t.virtualScrollerOptions.style),{height:t.scrollHeight}),className:g("p-dropdown-items-wrapper",t.virtualScrollerOptions.className),items:t.visibleOptions,autoSize:!0,onLazyLoad:function(e){return t.virtualScrollerOptions.onLazyLoad(X(X({},e),{filter:t.filterValue}))},itemTemplate:function(e,t){return e&&M(e,t.index,t)},contentTemplate:function(n){var r=F?j(t.hasFilter?t.emptyFilterMessage:t.emptyMessage):n.children,o=s({ref:n.contentRef,style:n.style,className:g(n.className,f("list",{virtualScrollerProps:t.virtualScrollerOptions})),role:"listbox"},D("list"));return e.createElement("ul",o,r)}});return e.createElement(S,C({ref:t.virtualScrollerRef},n,{pt:d("virtualScroller")}))}var r=h.isNotEmpty(t.visibleOptions)?t.visibleOptions.map(M):t.hasFilter?j(t.emptyFilterMessage,!0):j(t.emptyMessage),o=s({className:f("wrapper"),style:v("wrapper")},D("wrapper")),l=s({className:f("list"),role:"listbox"},D("list"));return e.createElement("div",o,e.createElement("ul",l,r))},V=(l=A(),i=K(),u=R(),c=s({className:g(t.panelClassName,f("panel",{context:b})),style:v("panel"),onClick:t.onClick},D("panel")),p=s({classNames:f("transition"),in:t.in,timeout:{enter:120,exit:100},options:t.transitionOptions,unmountOnExit:!0,onEnter:N,onEntered:L,onExit:t.onExit,onExited:t.onExited},D("transition")),e.createElement(I,C({nodeRef:o},p),e.createElement("div",C({ref:o},c),t.firstFocusableElement,l,i,u,t.lastFocusableElement)));return e.createElement(x,{element:V,appendTo:t.appendTo})})));function U(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=q(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 l,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,l=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw l}}}}function q(e,t){if(e){if("string"==typeof e)return z(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)?z(e,t):void 0}}function z(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 W(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?W(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}_.displayName="DropdownPanel";var $=e.memo(e.forwardRef((function(l,I){var O=a(),x=e.useContext(n),S=V.getProps(l,x),F=K(e.useState(""),2),k=F[0],D=F[1],L=K(e.useState(!1),2),P=L[0],T=L[1],j=K(e.useState(-1),2),M=j[0],G=j[1],A=K(e.useState(!1),2),H=A[0],B=A[1],J=e.useRef(!1),X=e.useRef(null),q=e.useRef(null),z=e.useRef(null),W=e.useRef(null),$=e.useRef(S.inputRef),Y=e.useRef(S.focusInputRef),Q=e.useRef(null),ee=e.useRef(null),te=e.useRef(null);e.useRef(null);var ne=S.virtualScrollerOptions&&S.virtualScrollerOptions.lazy,re=h.isNotEmpty(k),oe=S.appendTo||x&&x.appendTo||t.appendTo,le=V.setMetaData(Z(Z({props:S},S.__parentMetadata),{},{state:{filter:k,focused:P,overlayVisible:H}})),ie=le.ptm,ae=le.cx,ue=le.sx;i(V.css.styles,le.isUnstyled,{name:"dropdown"});var ce=K(u({target:X,overlay:q,listener:function(e,t){t.valid&&("outside"===t.type?!fe(e)&&Ze():Ze())},when:H}),2),pe=ce[0],se=ce[1],de=function(e){return(e||[]).reduce((function(e,t,n){e.push({optionGroup:t,group:!0,index:n,code:t.code,label:t.label});var r=ot(t);return r&&r.forEach((function(t){return e.push(t)})),e}),[])},fe=function(e){return y.isAttributeEquals(e.target,"data-pc-section","clearicon")||y.isAttributeEquals(e.target.parentElement||e.target,"data-pc-section","filterclearicon")},me=function(e){S.showOnFocus&&!H&&We(),T(!0),S.onFocus&&S.onFocus(e)},ve=function(e){T(!1),S.onBlur&&setTimeout((function(){var t=$.current?$.current.value:void 0;S.onBlur({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:S.name,id:S.id,value:t}})}),200)},be=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=tt(t);Xe({originalEvent:e,option:r}),n&&Ze()},ge=function(e){if(S.disabled||y.isAndroid())e.preventDefault();else{var t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":De(e);break;case"ArrowUp":Ce(e);break;case"ArrowLeft":case"ArrowRight":Ne(e,S.editable);break;case"Home":Le(e);break;case"End":Pe(e);break;case"PageDown":Te(e);break;case"PageUp":Re(e);break;case"Space":je(e,S.editable);break;case"NumpadEnter":case"Enter":Me(e);break;case"Escape":Ge(e);break;case"Tab":Ae(e);break;case"Backspace":Ke(e,S.editable);break;case"ShiftLeft":case"ShiftRight":break;default:!t&&h.isPrintableCharacter(e.key)&&(!H&&!S.editable&&We(),!S.editable&&xe(e,e.key))}J.current=!1}},he=function(e){var t;return ye(e)&&(null===(t=et(e))||void 0===t?void 0:t.toLocaleLowerCase(S.filterLocale).startsWith(te.current.toLocaleLowerCase(S.filterLocale)))},ye=function(e){return h.isNotEmpty(e)&&!(rt(e)||nt(e))},we=function(){return h.isNotEmpty(S.value)},Ee=function(e){return ye(e)&&ze(e)},Ie=function(){return we?dt.findIndex((function(e){return Ee(e)})):-1},Oe=function(){var e=Ie();return e<0?Se():e},xe=function(e,t){te.current=(te.current||"")+t;var n=-1,r=!1;return h.isNotEmpty(te.current)&&(-1!==(n=-1!==M?-1===(n=dt.slice(M).findIndex((function(e){return he(e)})))?dt.slice(0,M).findIndex((function(e){return he(e)})):n+M:dt.findIndex((function(e){return he(e)})))&&(r=!0),-1===n&&-1===M&&(n=Oe()),-1!==n&&ke(e,n)),ee.current&&clearTimeout(ee.current),ee.current=setTimeout((function(){te.current="",ee.current=null}),500),r},Se=function(){return dt.findIndex((function(e){return ye(e)}))},Fe=function(){return h.findLastIndex(dt,(function(e){return ye(e)}))},ke=function(e,t){M!==t&&(G(t),S.selectOnFocus&&be(e,dt[t],!1))},De=function(e){if(H){var t=-1!==M?(r=(n=M)<dt.length-1?dt.slice(n+1).findIndex((function(e){return ye(e)})):-1)>-1?r+n+1:n:J.current?Se():Oe();ke(e,t)}else We(),S.editable&&ke(e,Ie());var n,r;e.preventDefault()},Ce=function(e){var t,n,r;if(e.altKey&&!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))-1!==M&&be(e,dt[M]),state.overlayVisible&&Ze(),e.preventDefault();else{var o=-1!==M?(r=(n=M)>0?h.findLastIndex(dt.slice(0,n),(function(e){return ye(e)})):-1)>-1?r:n:J.current?Fe():(t=Ie())<0?Fe():t;ke(e,o),!H&&We(),e.preventDefault()}},Ne=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&G(-1)},Le=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?(e.currentTarget.setSelectionRange(0,0),G(-1)):(ke(e,Se()),!H&&We()),e.preventDefault()},Pe=function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var t=e.currentTarget,n=t.value.length;t.setSelectionRange(n,n),G(-1)}else ke(e,Fe()),!H&&We();e.preventDefault()},Re=function(e){e.preventDefault()},Te=function(e){e.preventDefault()},je=function(e){!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&Me(e)},Me=function(e){H?(-1!==M&&be(e,dt[M]),Ze()):(G(-1),De(e)),e.preventDefault()},Ge=function(e){H&&Ze(),e.preventDefault()},Ae=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]||(!H||y.getFocusableElements(q.current,':not([data-p-hidden-focusable="true"])').length>0?(-1!==M&&be(e,dt[M]),H&&Ze()):(y.focus(z.current),e.preventDefault()))},Ke=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&!H&&We()},Ve=function(e){var t=null;e.target.value&&(t=dt.findIndex((function(t){return et(t).toLocaleLowerCase().startsWith(e.target.value.toLocaleLowerCase())}))),G(t),S.onChange&&S.onChange({originalEvent:e.originalEvent,value:e.target.value,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:S.name,id:S.id,value:e.target.value}})},He=function(e){T(!0),Ze(),S.onFocus&&S.onFocus(e)},Be=function(e){D(""),S.onFilter&&S.onFilter({filter:""}),e&&e()},Je=function(e){S.onChange&&S.onChange({originalEvent:e,value:void 0,stopPropagation:function(){null==e||e.stopPropagation()},preventDefault:function(){null==e||e.preventDefault()},target:{name:S.name,id:S.id,value:void 0}}),S.filter&&Be(),Qe()},Xe=function(e){if(ft!==e.option){Qe(e.option),G(-1);var t=tt(e.option),n=qe(e.option,dt);S.onChange&&S.onChange({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:S.name,id:S.id,value:t}}),ke(e.originalEvent,n)}},_e=function(e){if(e=e||dt,null!=S.value&&e){if(!S.optionGroupLabel)return qe(S.value,e);for(var t=0;t<e.length;t++){var n=qe(S.value,ot(e[t]));if(-1!==n)return{group:t,option:n}}}return-1},Ue=function(){return S.optionValue?null:S.dataKey},qe=function(e,t){var n=Ue();return t.findIndex((function(t){return h.equals(e,tt(t),n)}))},ze=function(e){return h.equals(S.value,tt(e),Ue())},We=function(){G(-1!==M?M:S.autoOptionFocus?Oe():S.editable?-1:Ie()),B(!0)},Ze=function(){B(!1),J.current=!1},$e=function(){y.alignOverlay(q.current,$.current.parentElement,S.appendTo||x&&x.appendTo||t.appendTo)},Ye=function(){var e=y.findSingle(q.current,'li[data-p-focused="true"]');if(e&&e.scrollIntoView)e.scrollIntoView({block:"nearest",inline:"nearest"});else{var t=y.findSingle(q.current,'li[data-p-highlight="true"]');t&&t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"nearest"})}},Qe=function(e){$.current&&($.current.value=e?et(e):S.value||"",Y.current&&(Y.current.value=$.current.value))},et=function(e){return S.optionLabel?h.resolveFieldData(e,S.optionLabel):h.resolveFieldData(e,"label")||e},tt=function(e){return S.optionValue?h.resolveFieldData(e,S.optionValue):h.resolveFieldData(e,"value")||e},nt=function(e){return S.optionGroupLabel&&e.optionGroup&&e.group},rt=function(e){return S.optionDisabled?h.isFunction(S.optionDisabled)?S.optionDisabled(e):h.resolveFieldData(e,S.optionDisabled):!(!e||void 0===e.disabled)&&e.disabled},ot=function(e){return h.resolveFieldData(e,S.optionGroupChildren)},lt=function(){if(S.editable&&$.current){var e=(ft?et(ft):null)||S.value||"";$.current.value=e,Y.current&&(Y.current.value=e)}};e.useImperativeHandle(I,(function(){return{props:S,show:We,hide:Ze,clear:Je,focus:function(){return y.focus(Y.current)},getElement:function(){return X.current},getOverlay:function(){return q.current},getInput:function(){return $.current},getFocusInput:function(){return Y.current},getVirtualScroller:function(){return Q.current}}})),e.useEffect((function(){h.combinedRefs($,S.inputRef),h.combinedRefs(Y,S.focusInputRef)}),[$,S.inputRef,Y,S.focusInputRef]),c((function(){S.autoFocus&&y.focus(Y.current,S.autoFocus),$e()})),p((function(){H&&(S.value||M>=0)&&Ye()}),[H,S.value,M]),p((function(){H&&k&&S.filter&&$e()}),[H,k,S.filter]),p((function(){!k||S.options&&0!==S.options.length||D(""),lt(),$.current&&($.current.selectedIndex=1)})),s((function(){E.clear(q.current)}));var it,at,ut,ct,pt,st=function(e){"Enter"!==e.key&&"Space"!==e.code||(Je(e),e.preventDefault())},dt=function(){var e=S.optionGroupLabel?de(S.options):S.options;if(re&&!ne){var t=k.trim().toLocaleLowerCase(S.filterLocale),n=S.filterBy?S.filterBy.split(","):[S.optionLabel||"label"];if(S.optionGroupLabel){var r,l=[],i=U(S.options);try{for(i.s();!(r=i.n()).done;){var a=r.value,u=o.filter(ot(a),n,t,S.filterMatchMode,S.filterLocale);u&&u.length&&l.push(Z(Z({},a),R({},"".concat(S.optionGroupChildren),u)))}}catch(e){i.e(e)}finally{i.f()}return de(l)}return o.filter(e,n,t,S.filterMatchMode,S.filterLocale)}return e}(),ft=-1!==(it=_e(S.options))?S.optionGroupLabel?ot(S.options[it.group])[it.option]:S.options[it]:null,mt=h.isNotEmpty(S.tooltip),vt=V.getOtherProps(S),bt=h.reduceKeys(vt,y.ARIA_PROPS),gt=function(){var t={value:"",label:S.placeholder};if(ft){var n=tt(ft);t={value:"object"===N(n)?S.options.findIndex((function(e){return e===n})):n,label:et(ft)}}var r=O({className:"p-hidden-accessible p-dropdown-hidden-select"},ie("hiddenSelectedMessage")),o=O({ref:$,required:S.required,defaultValue:t.value,name:S.name,tabIndex:-1,"aria-hidden":"true"},ie("select")),l=O({value:t.value},ie("option"));return e.createElement("div",r,e.createElement("select",o,e.createElement("option",l,t.label)))}(),ht=function(){var t=h.isNotEmpty(ft)?et(ft):null;S.editable&&(t=t||S.value||"");var n=O({className:"p-hidden-accessible"},ie("hiddenSelectedMessage")),r=O(Z({ref:Y,id:S.inputId,defaultValue:t,type:"text",readOnly:!0,"aria-haspopup":"listbox",onFocus:me,onBlur:ve,onKeyDown:ge,disabled:S.disabled,tabIndex:S.disabled?-1:S.tabIndex||0},bt),ie("input"));return e.createElement("div",n,e.createElement("input",r))}(),yt=function(){var t=h.isNotEmpty(ft)?et(ft):null;if(S.editable){var n=O(Z({ref:$,type:"text",defaultValue:t||S.value||"",className:ae("input",{label:t}),disabled:S.disabled,placeholder:S.placeholder,maxLength:S.maxLength,onInput:Ve,onFocus:He,onKeyDown:ge,onBlur:ve,tabIndex:S.disabled?-1:S.tabIndex||0,"aria-haspopup":"listbox"},bt),ie("input"));return e.createElement("input",n)}var r=S.valueTemplate?h.getJSXElement(S.valueTemplate,ft,S):t||S.placeholder||"empty",o=O({ref:$,className:ae("input",{label:t}),tabIndex:"-1"},ie("input"));return e.createElement("span",o,r)}(),wt=S.loading?(at=O({className:ae("loadingIcon"),"data-pr-overlay-visible":H},ie("loadingIcon")),ut=w.getJSXIcon(S.loadingIcon||e.createElement(f,{spin:!0}),Z({},at),{props:S}),ct=S.placeholder||S.ariaLabel,pt=O({className:ae("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":H,"aria-label":ct},ie("trigger")),e.createElement("div",pt,ut)):function(){var t=O({className:ae("dropdownIcon"),"data-pr-overlay-visible":H},ie("dropdownIcon")),n=w.getJSXIcon(S.dropdownIcon||e.createElement(d,t),Z({},t),{props:S}),r=S.placeholder||S.ariaLabel,o=O({className:ae("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":H,"aria-label":r},ie("trigger"));return e.createElement("div",o,n)}(),Et=function(){if(null!=S.value&&S.showClear&&!S.disabled){var t=O({className:ae("clearIcon"),onPointerUp:Je,tabIndex:S.tabIndex||"0",onKeyDown:st,"aria-label":r("clear")},ie("clearIcon"));return w.getJSXIcon(S.clearIcon||e.createElement(m,t),Z({},t),{props:S})}return null}(),It=O({id:S.id,ref:X,className:g(S.className,ae("root",{context:x,focusedState:P,overlayVisibleState:H})),style:S.style,onClick:function(e){return t=e,void(S.disabled||S.loading||(S.onClick&&S.onClick(t),t.defaultPrevented||fe(t)||"INPUT"===t.target.tagName||(q.current&&q.current&&q.current.contains(t.target)||(y.focus(Y.current),H?Ze():We()),J.current=!0)));var t},onMouseDown:S.onMouseDown,onContextMenu:S.onContextMenu,onFocus:function(){S.editable&&!H&&!1===J.current&&y.focus($.current)},"data-p-disabled":S.disabled,"data-p-focus":P},vt,ie("root")),Ot=O({ref:z,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===Y.current?y.getFirstFocusableElement(q.current,':not([data-p-hidden-focusable="true"])'):Y.current;y.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},ie("hiddenFirstFocusableEl")),xt=O({ref:W,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===Y.current?y.getLastFocusableElement(q.current,':not([data-p-hidden-focusable="true"])'):Y.current;y.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},ie("hiddenLastFocusableEl"));return e.createElement(e.Fragment,null,e.createElement("div",It,ht,gt,yt,Et,wt,e.createElement(_,C({hostName:"Dropdown",ref:q,visibleOptions:dt,virtualScrollerRef:Q},S,{appendTo:oe,cx:ae,filterValue:k,focusedOptionIndex:M,getOptionGroupChildren:ot,getOptionGroupLabel:function(e){return h.resolveFieldData(e,S.optionGroupLabel)},getOptionGroupRenderKey:function(e){return h.resolveFieldData(e,S.optionGroupLabel)},getOptionLabel:et,getOptionRenderKey:function(e){return S.dataKey?h.resolveFieldData(e,S.dataKey):et(e)},getSelectedOptionIndex:_e,hasFilter:re,in:H,isOptionDisabled:rt,isSelected:ze,onClick:function(e){v.emit("overlay-click",{originalEvent:e,target:X.current})},onEnter:function(e){E.set("overlay",q.current,x&&x.autoZIndex||t.autoZIndex,x&&x.zIndex.overlay||t.zIndex.overlay),y.addStyles(q.current,{position:"absolute",top:"0",left:"0"}),$e(),e&&e()},onEntered:function(e){e&&e(),pe(),S.onShow&&S.onShow()},onExit:function(){se()},onExited:function(){S.filter&&S.resetFilterOnHide&&Be(),E.clear(q.current),S.onHide&&S.onHide()},onFilterClearIconClick:function(e){Be(e)},onFilterInputChange:function(e){var t=e.target.value;D(t),S.onFilter&&S.onFilter({originalEvent:e,filter:t})},onFilterInputKeyDown:function(e){switch(e.code){case"ArrowDown":De(e);break;case"ArrowUp":Ce(e);break;case"ArrowLeft":case"ArrowRight":Ne(e,!0);break;case"Escape":case"Enter":case"NumpadEnter":Me(e),e.preventDefault()}},onOptionClick:function(e){e.option.disabled||(Xe(e),y.focus(Y.current)),Ze()},ptm:ie,resetFilter:Be,changeFocusedOptionIndex:ke,firstFocusableElement:e.createElement("span",Ot),lastFocusableElement:e.createElement("span",xt),sx:ue}))),mt&&e.createElement(b,C({target:X,content:S.tooltip,pt:ie("tooltip")},S.tooltipOptions)))})));$.displayName="Dropdown";export{$ as Dropdown};
|
package/dropdown/dropdown.js
CHANGED
|
@@ -394,7 +394,7 @@ this.primereact.dropdown = (function (exports, React, PrimeReact, componentbase,
|
|
|
394
394
|
if (selected) {
|
|
395
395
|
var checkIconProps = mergeProps({
|
|
396
396
|
className: cx('checkIcon')
|
|
397
|
-
}, getPTOptions('
|
|
397
|
+
}, getPTOptions('checkIcon'));
|
|
398
398
|
return /*#__PURE__*/React__namespace.createElement(check.CheckIcon, checkIconProps);
|
|
399
399
|
}
|
|
400
400
|
var blankIconProps = mergeProps({
|
|
@@ -481,7 +481,7 @@ this.primereact.dropdown = (function (exports, React, PrimeReact, componentbase,
|
|
|
481
481
|
height: scrollerOptions.props ? scrollerOptions.props.itemSize : undefined
|
|
482
482
|
};
|
|
483
483
|
style = _objectSpread$1(_objectSpread$1({}, style), option.style);
|
|
484
|
-
if (option.group && props.optionGroupLabel) {
|
|
484
|
+
if (option.group && option.optionGroup && props.optionGroupLabel) {
|
|
485
485
|
var optionGroupLabel = props.optionGroupLabel;
|
|
486
486
|
var groupContent = props.optionGroupTemplate ? utils.ObjectUtils.getJSXElement(props.optionGroupTemplate, option, index) : props.getOptionGroupLabel(option);
|
|
487
487
|
var key = index + '_' + props.getOptionGroupRenderKey(option);
|
|
@@ -1355,7 +1355,7 @@ this.primereact.dropdown = (function (exports, React, PrimeReact, componentbase,
|
|
|
1355
1355
|
}
|
|
1356
1356
|
};
|
|
1357
1357
|
var getOptionLabel = function getOptionLabel(option) {
|
|
1358
|
-
return props.optionLabel ? utils.ObjectUtils.resolveFieldData(option, props.optionLabel) : utils.ObjectUtils.resolveFieldData(option, 'label');
|
|
1358
|
+
return props.optionLabel ? utils.ObjectUtils.resolveFieldData(option, props.optionLabel) : utils.ObjectUtils.resolveFieldData(option, 'label') || option;
|
|
1359
1359
|
};
|
|
1360
1360
|
var getOptionValue = function getOptionValue(option) {
|
|
1361
1361
|
return props.optionValue ? utils.ObjectUtils.resolveFieldData(option, props.optionValue) : utils.ObjectUtils.resolveFieldData(option, 'value') || option;
|
package/dropdown/dropdown.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.dropdown=function(e,t,n,r,o,l,i,a,c,u,s,p,d,f,m,v,b,g){"use strict";function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function y(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var w=y(t),O=h(n);function I(){return I=Object.assign?Object.assign.bind():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},I.apply(this,arguments)}function E(e){return E="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},E(e)}function x(e,t){if("object"!==E(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function S(e){var t=x(e,"string");return"symbol"===E(t)?t:String(t)}function D(e,t,n){return(t=S(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(e){if(Array.isArray(e))return e}function F(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,l,i,a=[],c=!0,u=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=l.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return a}}function N(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 C(e,t){if(e){if("string"==typeof e)return N(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)?N(e,t):void 0}}function k(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function L(e,t){return j(e)||F(e,t)||C(e,t)||k()}var P=r.ComponentBase.extend({defaultProps:{__TYPE:"Dropdown",__parentMetadata:null,appendTo:null,ariaLabel:null,ariaLabelledBy:null,autoFocus:!1,children:void 0,className:null,clearIcon:null,dataKey:null,disabled:!1,dropdownIcon:null,editable:!1,emptyFilterMessage:null,highlightOnSelect:!0,checkmark:!1,emptyMessage:null,filter:!1,filterBy:null,filterClearIcon:null,filterIcon:null,filterInputAutoFocus:!1,filterLocale:void 0,filterMatchMode:"contains",filterPlaceholder:null,filterTemplate:null,focusInputRef:null,id:null,inputId:null,inputRef:null,invalid:!1,variant:null,itemTemplate:null,loading:!1,loadingIcon:null,maxLength:null,name:null,onBlur:null,onChange:null,onContextMenu:null,onFilter:null,onFocus:null,onHide:null,onMouseDown:null,onShow:null,optionDisabled:null,optionGroupChildren:"items",selectOnFocus:!1,focusOnHover:!0,autoOptionFocus:!1,optionGroupLabel:null,optionGroupTemplate:null,optionLabel:null,optionValue:null,options:null,panelClassName:null,panelFooterTemplate:null,panelStyle:null,placeholder:null,required:!1,resetFilterOnHide:!1,scrollHeight:"200px",showClear:!1,showFilterClear:!1,showOnFocus:!1,style:null,tabIndex:null,tooltip:null,tooltipOptions:null,transitionOptions:null,value:null,valueTemplate:null,virtualScrollerOptions:null},css:{classes:{root:function(e){var t=e.props,n=e.focusedState,r=e.overlayVisibleState,o=e.context;return s.classNames("p-dropdown p-component p-inputwrapper",{"p-disabled":t.disabled,"p-invalid":t.invalid,"p-focus":n,"p-variant-filled":t.variant?"filled"===t.variant:o&&"filled"===o.inputStyle,"p-dropdown-clearable":t.showClear&&!t.disabled,"p-inputwrapper-filled":s.ObjectUtils.isNotEmpty(t.value),"p-inputwrapper-focus":n||r})},input:function(e){var t=e.props,n=e.label;return t.editable?"p-dropdown-label p-inputtext":s.classNames("p-dropdown-label p-inputtext",{"p-placeholder":null===n&&t.placeholder,"p-dropdown-label-empty":null===n&&!t.placeholder})},trigger:"p-dropdown-trigger",emptyMessage:"p-dropdown-empty-message",itemGroup:function(e){var t=e.optionGroupLabel;return s.classNames("p-dropdown-item-group",{"p-dropdown-item-empty":!t||0===t.length})},itemGroupLabel:"p-dropdown-item-group-label",dropdownIcon:"p-dropdown-trigger-icon p-clickable",loadingIcon:"p-dropdown-trigger-icon p-clickable",clearIcon:"p-dropdown-clear-icon p-clickable",filterIcon:"p-dropdown-filter-icon",filterClearIcon:"p-dropdown-filter-clear-icon",filterContainer:function(e){return s.classNames("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!e.clearIcon})},filterInput:function(e){var t=e.props,n=e.context;return s.classNames("p-dropdown-filter p-inputtext p-component",{"p-variant-filled":t.variant?"filled"===t.variant:n&&"filled"===n.inputStyle})},list:function(e){return"p-dropdown-items"},panel:function(e){var t=e.context;return s.classNames("p-dropdown-panel p-component",{"p-input-filled":t&&"filled"===t.inputStyle||"filled"===O.default.inputStyle,"p-ripple-disabled":t&&!1===t.ripple||!1===O.default.ripple})},item:function(e){var t=e.label;return s.classNames("p-dropdown-item",{"p-highlight":e.selected&&e.highlightOnSelect,"p-disabled":e.disabled,"p-focus":e.index===e.focusedOptionIndex,"p-dropdown-item-empty":!t||0===t.length})},itemLabel:"p-dropdown-item-label",checkIcon:"p-dropdown-check-icon",blankIcon:"p-dropdown-blank-icon",wrapper:"p-dropdown-items-wrapper",header:"p-dropdown-header",footer:"p-dropdown-footer",transition:"p-connected-overlay"},styles:"\n@layer primereact {\n .p-dropdown {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n }\n \n .p-dropdown-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n \n .p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n \n .p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n }\n \n input.p-dropdown-label {\n cursor: default;\n }\n \n .p-dropdown .p-dropdown-panel {\n min-width: 100%;\n }\n \n .p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n }\n \n .p-dropdown-items-wrapper {\n overflow: auto;\n }\n \n .p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n }\n \n .p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n \n .p-dropdown-filter {\n width: 100%;\n }\n \n .p-dropdown-filter-container {\n position: relative;\n }\n \n .p-dropdown-clear-icon,\n .p-dropdown-filter-icon,\n .p-dropdown-filter-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-fluid .p-dropdown {\n display: flex;\n }\n \n .p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n }\n}\n",inlineStyles:{wrapper:function(e){return{maxHeight:e.props.scrollHeight||"auto"}},panel:function(e){}}}}),U=w.memo(w.forwardRef((function(e,t){var n=g.IconBase.getPTI(e);return w.createElement("svg",I({ref:t,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),w.createElement("rect",{width:"1",height:"1",fill:"currentColor",fillOpacity:"0"}))})));U.displayName="BlankIcon";var R=w.memo((function(e){var t=o.useMergeProps(),n=e.ptm,r=e.cx,l=e.selected,i=e.disabled,a=e.option,c=e.label,u=e.index,p=e.focusedOptionIndex,d=e.checkmark,f=e.highlightOnSelect,m=function(e){return n(e,{context:{selected:l,disabled:i}})},g=e.template?s.ObjectUtils.getJSXElement(e.template,e.option):e.label,h=t({role:"option",key:e.label,className:s.classNames(a.className,r("item",{selected:l,disabled:i,label:c,index:u,focusedOptionIndex:p,highlightOnSelect:f})),style:e.style,onClick:function(t){return n=t,void(e.onClick&&e.onClick({originalEvent:n,option:a}));var n},onMouseMove:function(t){return null==e?void 0:e.onMouseMove(t,u)},"aria-label":c,"aria-selected":l,"data-p-highlight":l,"data-p-focused":p===u,"data-p-disabled":i},m("item")),y=t({className:r("itemLabel")},m("itemLabel"));return w.createElement("li",h,d&&function(){if(l){var e=t({className:r("checkIcon")},m("checIcon"));return w.createElement(b.CheckIcon,e)}var n=t({className:r("blankIcon")},m("blankIcon"));return w.createElement(U,n)}(),w.createElement("span",y,g),w.createElement(v.Ripple,null))}));function T(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 M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}R.displayName="DropdownItem";var H=w.memo(w.forwardRef((function(e,t){var r,l,i,c,u,v=o.useMergeProps(),b=e.ptm,g=e.cx,h=e.sx,y=w.useContext(n.PrimeReactContext),O=w.useRef(null),E=!(e.visibleOptions&&e.visibleOptions.length)&&e.hasFilter,x={filter:function(e){return F(e)},reset:function(){return e.resetFilter()}},S=function(t,n){return b(t,M({hostName:e.hostName},n))},D=function(){e.onEnter((function(){if(e.virtualScrollerRef.current){var t=e.getSelectedOptionIndex();-1!==t&&setTimeout((function(){return e.virtualScrollerRef.current.scrollToIndex(t)}),0)}}))},j=function(){e.onEntered((function(){e.filter&&e.filterInputAutoFocus&&s.DomHandler.focus(O.current,!1)}))},F=function(t){e.virtualScrollerRef.current&&e.virtualScrollerRef.current.scrollToIndex(0),e.onFilterInputChange&&e.onFilterInputChange(t)},N=function(){if(e.panelFooterTemplate){var t=s.ObjectUtils.getJSXElement(e.panelFooterTemplate,e,e.onOverlayHide),n=v({className:g("footer")},S("footer"));return w.createElement("div",n,t)}return null},C=function(t,n){var r;e.focusOnHover&&(null==e||null===(r=e.changeFocusedOptionIndex)||void 0===r||r.call(e,t,n))},k=function(t,r){var o=s.ObjectUtils.getJSXElement(t,e)||n.localeOption(r?"emptyFilterMessage":"emptyMessage"),l=v({className:g("emptyMessage")},S("emptyMessage"));return w.createElement("li",l,o)},L=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o={height:r.props?r.props.itemSize:void 0};if(o=M(M({},o),t.style),t.group&&e.optionGroupLabel){var l=e.optionGroupLabel,i=e.optionGroupTemplate?s.ObjectUtils.getJSXElement(e.optionGroupTemplate,t,n):e.getOptionGroupLabel(t),a=n+"_"+e.getOptionGroupRenderKey(t),c=v({className:g("itemGroup",{optionGroupLabel:l}),style:o,"data-p-highlight":e.selected},S("itemGroup")),u=v({className:g("itemGroupLabel")},S("itemGroupLabel"));return w.createElement("li",I({key:a},c),w.createElement("span",u,i))}var p=e.getOptionRenderKey(t)+"_"+n,d=e.getOptionLabel(t),f=e.isOptionDisabled(t);return w.createElement(R,{key:p,label:d,index:n,focusedOptionIndex:e.focusedOptionIndex,option:t,style:o,template:e.itemTemplate,selected:e.isSelected(t),highlightOnSelect:e.highlightOnSelect,disabled:f,onClick:e.onOptionClick,onMouseMove:C,ptm:b,cx:g,checkmark:e.checkmark})},P=function(){if(e.showFilterClear&&e.filterValue){var t=n.localeOption("clear"),r=v({className:g("filterClearIcon"),"aria-label":t,onClick:function(){return e.onFilterClearIconClick((function(){return s.DomHandler.focus(O.current)}))}},S("filterClearIcon"));return s.IconUtils.getJSXIcon(e.filterClearIcon||w.createElement(a.TimesIcon,r),M({},r),{props:e})}return null},U=function(){if(e.filter){var t=P(),n=v({className:g("filterIcon")},S("filterIcon")),r=s.IconUtils.getJSXIcon(e.filterIcon||w.createElement(d.SearchIcon,n),M({},n),{props:e}),o=v({className:g("filterContainer",{clearIcon:t})},S("filterContainer")),l=v({ref:O,type:"text",autoComplete:"off",className:g("filterInput",{context:y}),placeholder:e.filterPlaceholder,onKeyDown:e.onFilterInputKeyDown,onChange:function(e){return F(e)},value:e.filterValue},S("filterInput")),i=w.createElement("div",o,w.createElement("input",l),t,r);if(e.filterTemplate){var a={className:s.classNames("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!t}),element:i,filterOptions:x,filterInputKeyDown:e.onFilterInputKeyDown,filterInputChange:F,filterIconClassName:"p-dropdown-filter-icon",clearIcon:t,props:e};i=s.ObjectUtils.getJSXElement(e.filterTemplate,a)}var c=v({className:g("header")},S("header"));return w.createElement("div",c,i)}return null},T=function(){if(e.virtualScrollerOptions){var t=M(M({},e.virtualScrollerOptions),{style:M(M({},e.virtualScrollerOptions.style),{height:e.scrollHeight}),className:s.classNames("p-dropdown-items-wrapper",e.virtualScrollerOptions.className),items:e.visibleOptions,autoSize:!0,onLazyLoad:function(t){return e.virtualScrollerOptions.onLazyLoad(M(M({},t),{filter:e.filterValue}))},itemTemplate:function(e,t){return e&&L(e,t.index,t)},contentTemplate:function(t){var n=E?k(e.hasFilter?e.emptyFilterMessage:e.emptyMessage):t.children,r=v({ref:t.contentRef,style:t.style,className:s.classNames(t.className,g("list",{virtualScrollerProps:e.virtualScrollerOptions})),role:"listbox"},S("list"));return w.createElement("ul",r,n)}});return w.createElement(m.VirtualScroller,I({ref:e.virtualScrollerRef},t,{pt:b("virtualScroller")}))}var n=s.ObjectUtils.isNotEmpty(e.visibleOptions)?e.visibleOptions.map(L):e.hasFilter?k(e.emptyFilterMessage,!0):k(e.emptyMessage),r=v({className:g("wrapper"),style:h("wrapper")},S("wrapper")),o=v({className:g("list"),role:"listbox"},S("list"));return w.createElement("div",r,w.createElement("ul",o,n))},H=(r=U(),l=T(),i=N(),c=v({className:s.classNames(e.panelClassName,g("panel",{context:y})),style:h("panel"),onClick:e.onClick},S("panel")),u=v({classNames:g("transition"),in:e.in,timeout:{enter:120,exit:100},options:e.transitionOptions,unmountOnExit:!0,onEnter:D,onEntered:j,onExit:e.onExit,onExited:e.onExited},S("transition")),w.createElement(p.CSSTransition,I({nodeRef:t},u),w.createElement("div",I({ref:t},c),e.firstFocusableElement,r,l,i,e.lastFocusableElement)));return w.createElement(f.Portal,{element:H,appendTo:e.appendTo})})));function G(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=A(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 l,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,l=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw l}}}}function A(e,t){if(e){if("string"==typeof e)return V(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)?V(e,t):void 0}}function V(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 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 B(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){D(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}H.displayName="DropdownPanel";var _=w.memo(w.forwardRef((function(e,t){var p=o.useMergeProps(),d=w.useContext(n.PrimeReactContext),f=P.getProps(e,d),m=L(w.useState(""),2),v=m[0],b=m[1],g=L(w.useState(!1),2),h=g[0],y=g[1],x=L(w.useState(-1),2),S=x[0],j=x[1],F=L(w.useState(!1),2),N=F[0],C=F[1],k=w.useRef(!1),U=w.useRef(null),R=w.useRef(null),T=w.useRef(null),M=w.useRef(null),A=w.useRef(f.inputRef),V=w.useRef(f.focusInputRef),K=w.useRef(null),_=w.useRef(null),J=w.useRef(null);w.useRef(null);var X=f.virtualScrollerOptions&&f.virtualScrollerOptions.lazy,z=s.ObjectUtils.isNotEmpty(v),q=f.appendTo||d&&d.appendTo||O.default.appendTo,Z=P.setMetaData(B(B({props:f},f.__parentMetadata),{},{state:{filter:v,focused:h,overlayVisible:N}})),W=Z.ptm,$=Z.cx,Y=Z.sx;r.useHandleStyle(P.css.styles,Z.isUnstyled,{name:"dropdown"});var Q=L(o.useOverlayListener({target:U,overlay:R,listener:function(e,t){t.valid&&("outside"===t.type?!re(e)&&Ae():Ae())},when:N}),2),ee=Q[0],te=Q[1],ne=function(e){return(e||[]).reduce((function(e,t,n){e.push({optionGroup:t,group:!0,index:n,code:t.code,label:t.label});var r=qe(t);return r&&r.forEach((function(t){return e.push(t)})),e}),[])},re=function(e){return s.DomHandler.isAttributeEquals(e.target,"data-pc-section","clearicon")||s.DomHandler.isAttributeEquals(e.target.parentElement||e.target,"data-pc-section","filterclearicon")},oe=function(e){f.showOnFocus&&!N&&Ge(),y(!0),f.onFocus&&f.onFocus(e)},le=function(e){y(!1),f.onBlur&&setTimeout((function(){var t=A.current?A.current.value:void 0;f.onBlur({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:t}})}),200)},ie=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=Je(t);Ue({originalEvent:e,option:r}),n&&Ae()},ae=function(e){if(f.disabled||s.DomHandler.isAndroid())e.preventDefault();else{var t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":he(e);break;case"ArrowUp":ye(e);break;case"ArrowLeft":case"ArrowRight":we(e,f.editable);break;case"Home":Oe(e);break;case"End":Ie(e);break;case"PageDown":xe(e);break;case"PageUp":Ee(e);break;case"Space":Se(e,f.editable);break;case"NumpadEnter":case"Enter":De(e);break;case"Escape":je(e);break;case"Tab":Fe(e);break;case"Backspace":Ne(e,f.editable);break;case"ShiftLeft":case"ShiftRight":break;default:!t&&s.ObjectUtils.isPrintableCharacter(e.key)&&(!N&&!f.editable&&Ge(),!f.editable&&me(e,e.key))}k.current=!1}},ce=function(e){var t;return ue(e)&&(null===(t=_e(e))||void 0===t?void 0:t.toLocaleLowerCase(f.filterLocale).startsWith(J.current.toLocaleLowerCase(f.filterLocale)))},ue=function(e){return s.ObjectUtils.isNotEmpty(e)&&!(ze(e)||Xe(e))},se=function(){return s.ObjectUtils.isNotEmpty(f.value)},pe=function(e){return ue(e)&&He(e)},de=function(){return se?nt.findIndex((function(e){return pe(e)})):-1},fe=function(){var e=de();return e<0?ve():e},me=function(e,t){J.current=(J.current||"")+t;var n=-1,r=!1;return s.ObjectUtils.isNotEmpty(J.current)&&(-1!==(n=-1!==S?-1===(n=nt.slice(S).findIndex((function(e){return ce(e)})))?nt.slice(0,S).findIndex((function(e){return ce(e)})):n+S:nt.findIndex((function(e){return ce(e)})))&&(r=!0),-1===n&&-1===S&&(n=fe()),-1!==n&&ge(e,n)),_.current&&clearTimeout(_.current),_.current=setTimeout((function(){J.current="",_.current=null}),500),r},ve=function(){return nt.findIndex((function(e){return ue(e)}))},be=function(){return s.ObjectUtils.findLastIndex(nt,(function(e){return ue(e)}))},ge=function(e,t){S!==t&&(j(t),f.selectOnFocus&&ie(e,nt[t],!1))},he=function(e){if(N){var t=-1!==S?(r=(n=S)<nt.length-1?nt.slice(n+1).findIndex((function(e){return ue(e)})):-1)>-1?r+n+1:n:k.current?ve():fe();ge(e,t)}else Ge(),f.editable&&ge(e,de());var n,r;e.preventDefault()},ye=function(e){var t,n,r;if(e.altKey&&!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))-1!==S&&ie(e,nt[S]),state.overlayVisible&&Ae(),e.preventDefault();else{var o=-1!==S?(r=(n=S)>0?s.ObjectUtils.findLastIndex(nt.slice(0,n),(function(e){return ue(e)})):-1)>-1?r:n:k.current?be():(t=de())<0?be():t;ge(e,o),!N&&Ge(),e.preventDefault()}},we=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&j(-1)},Oe=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?(e.currentTarget.setSelectionRange(0,0),j(-1)):(ge(e,ve()),!N&&Ge()),e.preventDefault()},Ie=function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var t=e.currentTarget,n=t.value.length;t.setSelectionRange(n,n),j(-1)}else ge(e,be()),!N&&Ge();e.preventDefault()},Ee=function(e){e.preventDefault()},xe=function(e){e.preventDefault()},Se=function(e){!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&De(e)},De=function(e){N?(-1!==S&&ie(e,nt[S]),Ae()):(j(-1),he(e)),e.preventDefault()},je=function(e){N&&Ae(),e.preventDefault()},Fe=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]||(!N||s.DomHandler.getFocusableElements(R.current,':not([data-p-hidden-focusable="true"])').length>0?(-1!==S&&ie(e,nt[S]),N&&Ae()):(s.DomHandler.focus(T.current),e.preventDefault()))},Ne=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&!N&&Ge()},Ce=function(e){var t=null;e.target.value&&(t=nt.findIndex((function(t){return _e(t).toLocaleLowerCase().startsWith(e.target.value.toLocaleLowerCase())}))),j(t),f.onChange&&f.onChange({originalEvent:e.originalEvent,value:e.target.value,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:e.target.value}})},ke=function(e){y(!0),Ae(),f.onFocus&&f.onFocus(e)},Le=function(e){b(""),f.onFilter&&f.onFilter({filter:""}),e&&e()},Pe=function(e){f.onChange&&f.onChange({originalEvent:e,value:void 0,stopPropagation:function(){null==e||e.stopPropagation()},preventDefault:function(){null==e||e.preventDefault()},target:{name:f.name,id:f.id,value:void 0}}),f.filter&&Le(),Be()},Ue=function(e){if(rt!==e.option){Be(e.option),j(-1);var t=Je(e.option),n=Me(e.option,nt);f.onChange&&f.onChange({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:t}}),ge(e.originalEvent,n)}},Re=function(e){if(e=e||nt,null!=f.value&&e){if(!f.optionGroupLabel)return Me(f.value,e);for(var t=0;t<e.length;t++){var n=Me(f.value,qe(e[t]));if(-1!==n)return{group:t,option:n}}}return-1},Te=function(){return f.optionValue?null:f.dataKey},Me=function(e,t){var n=Te();return t.findIndex((function(t){return s.ObjectUtils.equals(e,Je(t),n)}))},He=function(e){return s.ObjectUtils.equals(f.value,Je(e),Te())},Ge=function(){j(-1!==S?S:f.autoOptionFocus?fe():f.editable?-1:de()),C(!0)},Ae=function(){C(!1),k.current=!1},Ve=function(){s.DomHandler.alignOverlay(R.current,A.current.parentElement,f.appendTo||d&&d.appendTo||O.default.appendTo)},Ke=function(){var e=s.DomHandler.findSingle(R.current,'li[data-p-focused="true"]');if(e&&e.scrollIntoView)e.scrollIntoView({block:"nearest",inline:"nearest"});else{var t=s.DomHandler.findSingle(R.current,'li[data-p-highlight="true"]');t&&t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"nearest"})}},Be=function(e){A.current&&(A.current.value=e?_e(e):f.value||"",V.current&&(V.current.value=A.current.value))},_e=function(e){return s.ObjectUtils.resolveFieldData(e,f.optionLabel?f.optionLabel:"label")},Je=function(e){return f.optionValue?s.ObjectUtils.resolveFieldData(e,f.optionValue):s.ObjectUtils.resolveFieldData(e,"value")||e},Xe=function(e){return f.optionGroupLabel&&e.optionGroup&&e.group},ze=function(e){return f.optionDisabled?s.ObjectUtils.isFunction(f.optionDisabled)?f.optionDisabled(e):s.ObjectUtils.resolveFieldData(e,f.optionDisabled):!(!e||void 0===e.disabled)&&e.disabled},qe=function(e){return s.ObjectUtils.resolveFieldData(e,f.optionGroupChildren)},Ze=function(){if(f.editable&&A.current){var e=(rt?_e(rt):null)||f.value||"";A.current.value=e,V.current&&(V.current.value=e)}};w.useImperativeHandle(t,(function(){return{props:f,show:Ge,hide:Ae,clear:Pe,focus:function(){return s.DomHandler.focus(V.current)},getElement:function(){return U.current},getOverlay:function(){return R.current},getInput:function(){return A.current},getFocusInput:function(){return V.current},getVirtualScroller:function(){return K.current}}})),w.useEffect((function(){s.ObjectUtils.combinedRefs(A,f.inputRef),s.ObjectUtils.combinedRefs(V,f.focusInputRef)}),[A,f.inputRef,V,f.focusInputRef]),o.useMountEffect((function(){f.autoFocus&&s.DomHandler.focus(V.current,f.autoFocus),Ve()})),o.useUpdateEffect((function(){N&&(f.value||S>=0)&&Ke()}),[N,f.value,S]),o.useUpdateEffect((function(){N&&v&&f.filter&&Ve()}),[N,v,f.filter]),o.useUpdateEffect((function(){!v||f.options&&0!==f.options.length||b(""),Ze(),A.current&&(A.current.selectedIndex=1)})),o.useUnmountEffect((function(){s.ZIndexUtils.clear(R.current)}));var We,$e,Ye,Qe,et,tt=function(e){"Enter"!==e.key&&"Space"!==e.code||(Pe(e),e.preventDefault())},nt=function(){var e=f.optionGroupLabel?ne(f.options):f.options;if(z&&!X){var t=v.trim().toLocaleLowerCase(f.filterLocale),r=f.filterBy?f.filterBy.split(","):[f.optionLabel||"label"];if(f.optionGroupLabel){var o,l=[],i=G(f.options);try{for(i.s();!(o=i.n()).done;){var a=o.value,c=n.FilterService.filter(qe(a),r,t,f.filterMatchMode,f.filterLocale);c&&c.length&&l.push(B(B({},a),D({},"".concat(f.optionGroupChildren),c)))}}catch(e){i.e(e)}finally{i.f()}return ne(l)}return n.FilterService.filter(e,r,t,f.filterMatchMode,f.filterLocale)}return e}(),rt=-1!==(We=Re(f.options))?f.optionGroupLabel?qe(f.options[We.group])[We.option]:f.options[We]:null,ot=s.ObjectUtils.isNotEmpty(f.tooltip),lt=P.getOtherProps(f),it=s.ObjectUtils.reduceKeys(lt,s.DomHandler.ARIA_PROPS),at=function(){var e={value:"",label:f.placeholder};if(rt){var t=Je(rt);e={value:"object"===E(t)?f.options.findIndex((function(e){return e===t})):t,label:_e(rt)}}var n=p({className:"p-hidden-accessible p-dropdown-hidden-select"},W("hiddenSelectedMessage")),r=p({ref:A,required:f.required,defaultValue:e.value,name:f.name,tabIndex:-1,"aria-hidden":"true"},W("select")),o=p({value:e.value},W("option"));return w.createElement("div",n,w.createElement("select",r,w.createElement("option",o,e.label)))}(),ct=function(){var e=s.ObjectUtils.isNotEmpty(rt)?_e(rt):null;f.editable&&(e=e||f.value||"");var t=p({className:"p-hidden-accessible"},W("hiddenSelectedMessage")),n=p(B({ref:V,id:f.inputId,defaultValue:e,type:"text",readOnly:!0,"aria-haspopup":"listbox",onFocus:oe,onBlur:le,onKeyDown:ae,disabled:f.disabled,tabIndex:f.disabled?-1:f.tabIndex||0},it),W("input"));return w.createElement("div",t,w.createElement("input",n))}(),ut=function(){var e=s.ObjectUtils.isNotEmpty(rt)?_e(rt):null;if(f.editable){var t=p(B({ref:A,type:"text",defaultValue:e||f.value||"",className:$("input",{label:e}),disabled:f.disabled,placeholder:f.placeholder,maxLength:f.maxLength,onInput:Ce,onFocus:ke,onKeyDown:ae,onBlur:le,tabIndex:f.disabled?-1:f.tabIndex||0,"aria-haspopup":"listbox"},it),W("input"));return w.createElement("input",t)}var n=f.valueTemplate?s.ObjectUtils.getJSXElement(f.valueTemplate,rt,f):e||f.placeholder||"empty",r=p({ref:A,className:$("input",{label:e}),tabIndex:"-1"},W("input"));return w.createElement("span",r,n)}(),st=f.loading?($e=p({className:$("loadingIcon"),"data-pr-overlay-visible":N},W("loadingIcon")),Ye=s.IconUtils.getJSXIcon(f.loadingIcon||w.createElement(i.SpinnerIcon,{spin:!0}),B({},$e),{props:f}),Qe=f.placeholder||f.ariaLabel,et=p({className:$("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":N,"aria-label":Qe},W("trigger")),w.createElement("div",et,Ye)):function(){var e=p({className:$("dropdownIcon"),"data-pr-overlay-visible":N},W("dropdownIcon")),t=s.IconUtils.getJSXIcon(f.dropdownIcon||w.createElement(l.ChevronDownIcon,e),B({},e),{props:f}),n=f.placeholder||f.ariaLabel,r=p({className:$("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":N,"aria-label":n},W("trigger"));return w.createElement("div",r,t)}(),pt=function(){if(null!=f.value&&f.showClear&&!f.disabled){var e=p({className:$("clearIcon"),onPointerUp:Pe,tabIndex:f.tabIndex||"0",onKeyDown:tt,"aria-label":n.localeOption("clear")},W("clearIcon"));return s.IconUtils.getJSXIcon(f.clearIcon||w.createElement(a.TimesIcon,e),B({},e),{props:f})}return null}(),dt=p({id:f.id,ref:U,className:s.classNames(f.className,$("root",{context:d,focusedState:h,overlayVisibleState:N})),style:f.style,onClick:function(e){return t=e,void(f.disabled||f.loading||(f.onClick&&f.onClick(t),t.defaultPrevented||re(t)||"INPUT"===t.target.tagName||(R.current&&R.current&&R.current.contains(t.target)||(s.DomHandler.focus(V.current),N?Ae():Ge()),k.current=!0)));var t},onMouseDown:f.onMouseDown,onContextMenu:f.onContextMenu,onFocus:function(){f.editable&&!N&&!1===k.current&&s.DomHandler.focus(A.current)},"data-p-disabled":f.disabled,"data-p-focus":h},lt,W("root")),ft=p({ref:T,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===V.current?s.DomHandler.getFirstFocusableElement(R.current,':not([data-p-hidden-focusable="true"])'):V.current;s.DomHandler.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},W("hiddenFirstFocusableEl")),mt=p({ref:M,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===V.current?s.DomHandler.getLastFocusableElement(R.current,':not([data-p-hidden-focusable="true"])'):V.current;s.DomHandler.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},W("hiddenLastFocusableEl"));return w.createElement(w.Fragment,null,w.createElement("div",dt,ct,at,ut,pt,st,w.createElement(H,I({hostName:"Dropdown",ref:R,visibleOptions:nt,virtualScrollerRef:K},f,{appendTo:q,cx:$,filterValue:v,focusedOptionIndex:S,getOptionGroupChildren:qe,getOptionGroupLabel:function(e){return s.ObjectUtils.resolveFieldData(e,f.optionGroupLabel)},getOptionGroupRenderKey:function(e){return s.ObjectUtils.resolveFieldData(e,f.optionGroupLabel)},getOptionLabel:_e,getOptionRenderKey:function(e){return f.dataKey?s.ObjectUtils.resolveFieldData(e,f.dataKey):_e(e)},getSelectedOptionIndex:Re,hasFilter:z,in:N,isOptionDisabled:ze,isSelected:He,onClick:function(e){c.OverlayService.emit("overlay-click",{originalEvent:e,target:U.current})},onEnter:function(e){s.ZIndexUtils.set("overlay",R.current,d&&d.autoZIndex||O.default.autoZIndex,d&&d.zIndex.overlay||O.default.zIndex.overlay),s.DomHandler.addStyles(R.current,{position:"absolute",top:"0",left:"0"}),Ve(),e&&e()},onEntered:function(e){e&&e(),ee(),f.onShow&&f.onShow()},onExit:function(){te()},onExited:function(){f.filter&&f.resetFilterOnHide&&Le(),s.ZIndexUtils.clear(R.current),f.onHide&&f.onHide()},onFilterClearIconClick:function(e){Le(e)},onFilterInputChange:function(e){var t=e.target.value;b(t),f.onFilter&&f.onFilter({originalEvent:e,filter:t})},onFilterInputKeyDown:function(e){switch(e.code){case"ArrowDown":he(e);break;case"ArrowUp":ye(e);break;case"ArrowLeft":case"ArrowRight":we(e,!0);break;case"Escape":case"Enter":case"NumpadEnter":De(e),e.preventDefault()}},onOptionClick:function(e){e.option.disabled||(Ue(e),s.DomHandler.focus(V.current)),Ae()},ptm:W,resetFilter:Le,changeFocusedOptionIndex:ge,firstFocusableElement:w.createElement("span",ft),lastFocusableElement:w.createElement("span",mt),sx:Y}))),ot&&w.createElement(u.Tooltip,I({target:U,content:f.tooltip,pt:W("tooltip")},f.tooltipOptions)))})));return _.displayName="Dropdown",e.Dropdown=_,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.componentbase,primereact.hooks,primereact.icons.chevrondown,primereact.icons.spinner,primereact.icons.times,primereact.overlayservice,primereact.tooltip,primereact.utils,primereact.csstransition,primereact.icons.search,primereact.portal,primereact.virtualscroller,primereact.ripple,primereact.icons.check,primereact.iconbase);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.dropdown=function(e,t,n,r,o,l,i,a,c,u,s,p,d,f,m,v,b,g){"use strict";function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function y(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var w=y(t),O=h(n);function I(){return I=Object.assign?Object.assign.bind():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},I.apply(this,arguments)}function E(e){return E="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},E(e)}function x(e,t){if("object"!==E(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function S(e){var t=x(e,"string");return"symbol"===E(t)?t:String(t)}function D(e,t,n){return(t=S(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(e){if(Array.isArray(e))return e}function F(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,l,i,a=[],c=!0,u=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=l.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return a}}function N(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 C(e,t){if(e){if("string"==typeof e)return N(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)?N(e,t):void 0}}function k(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function L(e,t){return j(e)||F(e,t)||C(e,t)||k()}var P=r.ComponentBase.extend({defaultProps:{__TYPE:"Dropdown",__parentMetadata:null,appendTo:null,ariaLabel:null,ariaLabelledBy:null,autoFocus:!1,children:void 0,className:null,clearIcon:null,dataKey:null,disabled:!1,dropdownIcon:null,editable:!1,emptyFilterMessage:null,highlightOnSelect:!0,checkmark:!1,emptyMessage:null,filter:!1,filterBy:null,filterClearIcon:null,filterIcon:null,filterInputAutoFocus:!1,filterLocale:void 0,filterMatchMode:"contains",filterPlaceholder:null,filterTemplate:null,focusInputRef:null,id:null,inputId:null,inputRef:null,invalid:!1,variant:null,itemTemplate:null,loading:!1,loadingIcon:null,maxLength:null,name:null,onBlur:null,onChange:null,onContextMenu:null,onFilter:null,onFocus:null,onHide:null,onMouseDown:null,onShow:null,optionDisabled:null,optionGroupChildren:"items",selectOnFocus:!1,focusOnHover:!0,autoOptionFocus:!1,optionGroupLabel:null,optionGroupTemplate:null,optionLabel:null,optionValue:null,options:null,panelClassName:null,panelFooterTemplate:null,panelStyle:null,placeholder:null,required:!1,resetFilterOnHide:!1,scrollHeight:"200px",showClear:!1,showFilterClear:!1,showOnFocus:!1,style:null,tabIndex:null,tooltip:null,tooltipOptions:null,transitionOptions:null,value:null,valueTemplate:null,virtualScrollerOptions:null},css:{classes:{root:function(e){var t=e.props,n=e.focusedState,r=e.overlayVisibleState,o=e.context;return s.classNames("p-dropdown p-component p-inputwrapper",{"p-disabled":t.disabled,"p-invalid":t.invalid,"p-focus":n,"p-variant-filled":t.variant?"filled"===t.variant:o&&"filled"===o.inputStyle,"p-dropdown-clearable":t.showClear&&!t.disabled,"p-inputwrapper-filled":s.ObjectUtils.isNotEmpty(t.value),"p-inputwrapper-focus":n||r})},input:function(e){var t=e.props,n=e.label;return t.editable?"p-dropdown-label p-inputtext":s.classNames("p-dropdown-label p-inputtext",{"p-placeholder":null===n&&t.placeholder,"p-dropdown-label-empty":null===n&&!t.placeholder})},trigger:"p-dropdown-trigger",emptyMessage:"p-dropdown-empty-message",itemGroup:function(e){var t=e.optionGroupLabel;return s.classNames("p-dropdown-item-group",{"p-dropdown-item-empty":!t||0===t.length})},itemGroupLabel:"p-dropdown-item-group-label",dropdownIcon:"p-dropdown-trigger-icon p-clickable",loadingIcon:"p-dropdown-trigger-icon p-clickable",clearIcon:"p-dropdown-clear-icon p-clickable",filterIcon:"p-dropdown-filter-icon",filterClearIcon:"p-dropdown-filter-clear-icon",filterContainer:function(e){return s.classNames("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!e.clearIcon})},filterInput:function(e){var t=e.props,n=e.context;return s.classNames("p-dropdown-filter p-inputtext p-component",{"p-variant-filled":t.variant?"filled"===t.variant:n&&"filled"===n.inputStyle})},list:function(e){return"p-dropdown-items"},panel:function(e){var t=e.context;return s.classNames("p-dropdown-panel p-component",{"p-input-filled":t&&"filled"===t.inputStyle||"filled"===O.default.inputStyle,"p-ripple-disabled":t&&!1===t.ripple||!1===O.default.ripple})},item:function(e){var t=e.label;return s.classNames("p-dropdown-item",{"p-highlight":e.selected&&e.highlightOnSelect,"p-disabled":e.disabled,"p-focus":e.index===e.focusedOptionIndex,"p-dropdown-item-empty":!t||0===t.length})},itemLabel:"p-dropdown-item-label",checkIcon:"p-dropdown-check-icon",blankIcon:"p-dropdown-blank-icon",wrapper:"p-dropdown-items-wrapper",header:"p-dropdown-header",footer:"p-dropdown-footer",transition:"p-connected-overlay"},styles:"\n@layer primereact {\n .p-dropdown {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n }\n \n .p-dropdown-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n \n .p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n \n .p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n }\n \n input.p-dropdown-label {\n cursor: default;\n }\n \n .p-dropdown .p-dropdown-panel {\n min-width: 100%;\n }\n \n .p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n }\n \n .p-dropdown-items-wrapper {\n overflow: auto;\n }\n \n .p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n }\n \n .p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n \n .p-dropdown-filter {\n width: 100%;\n }\n \n .p-dropdown-filter-container {\n position: relative;\n }\n \n .p-dropdown-clear-icon,\n .p-dropdown-filter-icon,\n .p-dropdown-filter-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-fluid .p-dropdown {\n display: flex;\n }\n \n .p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n }\n}\n",inlineStyles:{wrapper:function(e){return{maxHeight:e.props.scrollHeight||"auto"}},panel:function(e){}}}}),U=w.memo(w.forwardRef((function(e,t){var n=g.IconBase.getPTI(e);return w.createElement("svg",I({ref:t,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),w.createElement("rect",{width:"1",height:"1",fill:"currentColor",fillOpacity:"0"}))})));U.displayName="BlankIcon";var R=w.memo((function(e){var t=o.useMergeProps(),n=e.ptm,r=e.cx,l=e.selected,i=e.disabled,a=e.option,c=e.label,u=e.index,p=e.focusedOptionIndex,d=e.checkmark,f=e.highlightOnSelect,m=function(e){return n(e,{context:{selected:l,disabled:i}})},g=e.template?s.ObjectUtils.getJSXElement(e.template,e.option):e.label,h=t({role:"option",key:e.label,className:s.classNames(a.className,r("item",{selected:l,disabled:i,label:c,index:u,focusedOptionIndex:p,highlightOnSelect:f})),style:e.style,onClick:function(t){return n=t,void(e.onClick&&e.onClick({originalEvent:n,option:a}));var n},onMouseMove:function(t){return null==e?void 0:e.onMouseMove(t,u)},"aria-label":c,"aria-selected":l,"data-p-highlight":l,"data-p-focused":p===u,"data-p-disabled":i},m("item")),y=t({className:r("itemLabel")},m("itemLabel"));return w.createElement("li",h,d&&function(){if(l){var e=t({className:r("checkIcon")},m("checkIcon"));return w.createElement(b.CheckIcon,e)}var n=t({className:r("blankIcon")},m("blankIcon"));return w.createElement(U,n)}(),w.createElement("span",y,g),w.createElement(v.Ripple,null))}));function T(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 M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}R.displayName="DropdownItem";var H=w.memo(w.forwardRef((function(e,t){var r,l,i,c,u,v=o.useMergeProps(),b=e.ptm,g=e.cx,h=e.sx,y=w.useContext(n.PrimeReactContext),O=w.useRef(null),E=!(e.visibleOptions&&e.visibleOptions.length)&&e.hasFilter,x={filter:function(e){return F(e)},reset:function(){return e.resetFilter()}},S=function(t,n){return b(t,M({hostName:e.hostName},n))},D=function(){e.onEnter((function(){if(e.virtualScrollerRef.current){var t=e.getSelectedOptionIndex();-1!==t&&setTimeout((function(){return e.virtualScrollerRef.current.scrollToIndex(t)}),0)}}))},j=function(){e.onEntered((function(){e.filter&&e.filterInputAutoFocus&&s.DomHandler.focus(O.current,!1)}))},F=function(t){e.virtualScrollerRef.current&&e.virtualScrollerRef.current.scrollToIndex(0),e.onFilterInputChange&&e.onFilterInputChange(t)},N=function(){if(e.panelFooterTemplate){var t=s.ObjectUtils.getJSXElement(e.panelFooterTemplate,e,e.onOverlayHide),n=v({className:g("footer")},S("footer"));return w.createElement("div",n,t)}return null},C=function(t,n){var r;e.focusOnHover&&(null==e||null===(r=e.changeFocusedOptionIndex)||void 0===r||r.call(e,t,n))},k=function(t,r){var o=s.ObjectUtils.getJSXElement(t,e)||n.localeOption(r?"emptyFilterMessage":"emptyMessage"),l=v({className:g("emptyMessage")},S("emptyMessage"));return w.createElement("li",l,o)},L=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o={height:r.props?r.props.itemSize:void 0};if(o=M(M({},o),t.style),t.group&&t.optionGroup&&e.optionGroupLabel){var l=e.optionGroupLabel,i=e.optionGroupTemplate?s.ObjectUtils.getJSXElement(e.optionGroupTemplate,t,n):e.getOptionGroupLabel(t),a=n+"_"+e.getOptionGroupRenderKey(t),c=v({className:g("itemGroup",{optionGroupLabel:l}),style:o,"data-p-highlight":e.selected},S("itemGroup")),u=v({className:g("itemGroupLabel")},S("itemGroupLabel"));return w.createElement("li",I({key:a},c),w.createElement("span",u,i))}var p=e.getOptionRenderKey(t)+"_"+n,d=e.getOptionLabel(t),f=e.isOptionDisabled(t);return w.createElement(R,{key:p,label:d,index:n,focusedOptionIndex:e.focusedOptionIndex,option:t,style:o,template:e.itemTemplate,selected:e.isSelected(t),highlightOnSelect:e.highlightOnSelect,disabled:f,onClick:e.onOptionClick,onMouseMove:C,ptm:b,cx:g,checkmark:e.checkmark})},P=function(){if(e.showFilterClear&&e.filterValue){var t=n.localeOption("clear"),r=v({className:g("filterClearIcon"),"aria-label":t,onClick:function(){return e.onFilterClearIconClick((function(){return s.DomHandler.focus(O.current)}))}},S("filterClearIcon"));return s.IconUtils.getJSXIcon(e.filterClearIcon||w.createElement(a.TimesIcon,r),M({},r),{props:e})}return null},U=function(){if(e.filter){var t=P(),n=v({className:g("filterIcon")},S("filterIcon")),r=s.IconUtils.getJSXIcon(e.filterIcon||w.createElement(d.SearchIcon,n),M({},n),{props:e}),o=v({className:g("filterContainer",{clearIcon:t})},S("filterContainer")),l=v({ref:O,type:"text",autoComplete:"off",className:g("filterInput",{context:y}),placeholder:e.filterPlaceholder,onKeyDown:e.onFilterInputKeyDown,onChange:function(e){return F(e)},value:e.filterValue},S("filterInput")),i=w.createElement("div",o,w.createElement("input",l),t,r);if(e.filterTemplate){var a={className:s.classNames("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!t}),element:i,filterOptions:x,filterInputKeyDown:e.onFilterInputKeyDown,filterInputChange:F,filterIconClassName:"p-dropdown-filter-icon",clearIcon:t,props:e};i=s.ObjectUtils.getJSXElement(e.filterTemplate,a)}var c=v({className:g("header")},S("header"));return w.createElement("div",c,i)}return null},T=function(){if(e.virtualScrollerOptions){var t=M(M({},e.virtualScrollerOptions),{style:M(M({},e.virtualScrollerOptions.style),{height:e.scrollHeight}),className:s.classNames("p-dropdown-items-wrapper",e.virtualScrollerOptions.className),items:e.visibleOptions,autoSize:!0,onLazyLoad:function(t){return e.virtualScrollerOptions.onLazyLoad(M(M({},t),{filter:e.filterValue}))},itemTemplate:function(e,t){return e&&L(e,t.index,t)},contentTemplate:function(t){var n=E?k(e.hasFilter?e.emptyFilterMessage:e.emptyMessage):t.children,r=v({ref:t.contentRef,style:t.style,className:s.classNames(t.className,g("list",{virtualScrollerProps:e.virtualScrollerOptions})),role:"listbox"},S("list"));return w.createElement("ul",r,n)}});return w.createElement(m.VirtualScroller,I({ref:e.virtualScrollerRef},t,{pt:b("virtualScroller")}))}var n=s.ObjectUtils.isNotEmpty(e.visibleOptions)?e.visibleOptions.map(L):e.hasFilter?k(e.emptyFilterMessage,!0):k(e.emptyMessage),r=v({className:g("wrapper"),style:h("wrapper")},S("wrapper")),o=v({className:g("list"),role:"listbox"},S("list"));return w.createElement("div",r,w.createElement("ul",o,n))},H=(r=U(),l=T(),i=N(),c=v({className:s.classNames(e.panelClassName,g("panel",{context:y})),style:h("panel"),onClick:e.onClick},S("panel")),u=v({classNames:g("transition"),in:e.in,timeout:{enter:120,exit:100},options:e.transitionOptions,unmountOnExit:!0,onEnter:D,onEntered:j,onExit:e.onExit,onExited:e.onExited},S("transition")),w.createElement(p.CSSTransition,I({nodeRef:t},u),w.createElement("div",I({ref:t},c),e.firstFocusableElement,r,l,i,e.lastFocusableElement)));return w.createElement(f.Portal,{element:H,appendTo:e.appendTo})})));function G(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=A(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 l,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,l=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw l}}}}function A(e,t){if(e){if("string"==typeof e)return V(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)?V(e,t):void 0}}function V(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 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 B(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){D(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}H.displayName="DropdownPanel";var _=w.memo(w.forwardRef((function(e,t){var p=o.useMergeProps(),d=w.useContext(n.PrimeReactContext),f=P.getProps(e,d),m=L(w.useState(""),2),v=m[0],b=m[1],g=L(w.useState(!1),2),h=g[0],y=g[1],x=L(w.useState(-1),2),S=x[0],j=x[1],F=L(w.useState(!1),2),N=F[0],C=F[1],k=w.useRef(!1),U=w.useRef(null),R=w.useRef(null),T=w.useRef(null),M=w.useRef(null),A=w.useRef(f.inputRef),V=w.useRef(f.focusInputRef),K=w.useRef(null),_=w.useRef(null),J=w.useRef(null);w.useRef(null);var X=f.virtualScrollerOptions&&f.virtualScrollerOptions.lazy,z=s.ObjectUtils.isNotEmpty(v),q=f.appendTo||d&&d.appendTo||O.default.appendTo,Z=P.setMetaData(B(B({props:f},f.__parentMetadata),{},{state:{filter:v,focused:h,overlayVisible:N}})),W=Z.ptm,$=Z.cx,Y=Z.sx;r.useHandleStyle(P.css.styles,Z.isUnstyled,{name:"dropdown"});var Q=L(o.useOverlayListener({target:U,overlay:R,listener:function(e,t){t.valid&&("outside"===t.type?!re(e)&&Ae():Ae())},when:N}),2),ee=Q[0],te=Q[1],ne=function(e){return(e||[]).reduce((function(e,t,n){e.push({optionGroup:t,group:!0,index:n,code:t.code,label:t.label});var r=qe(t);return r&&r.forEach((function(t){return e.push(t)})),e}),[])},re=function(e){return s.DomHandler.isAttributeEquals(e.target,"data-pc-section","clearicon")||s.DomHandler.isAttributeEquals(e.target.parentElement||e.target,"data-pc-section","filterclearicon")},oe=function(e){f.showOnFocus&&!N&&Ge(),y(!0),f.onFocus&&f.onFocus(e)},le=function(e){y(!1),f.onBlur&&setTimeout((function(){var t=A.current?A.current.value:void 0;f.onBlur({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:t}})}),200)},ie=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=Je(t);Ue({originalEvent:e,option:r}),n&&Ae()},ae=function(e){if(f.disabled||s.DomHandler.isAndroid())e.preventDefault();else{var t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":he(e);break;case"ArrowUp":ye(e);break;case"ArrowLeft":case"ArrowRight":we(e,f.editable);break;case"Home":Oe(e);break;case"End":Ie(e);break;case"PageDown":xe(e);break;case"PageUp":Ee(e);break;case"Space":Se(e,f.editable);break;case"NumpadEnter":case"Enter":De(e);break;case"Escape":je(e);break;case"Tab":Fe(e);break;case"Backspace":Ne(e,f.editable);break;case"ShiftLeft":case"ShiftRight":break;default:!t&&s.ObjectUtils.isPrintableCharacter(e.key)&&(!N&&!f.editable&&Ge(),!f.editable&&me(e,e.key))}k.current=!1}},ce=function(e){var t;return ue(e)&&(null===(t=_e(e))||void 0===t?void 0:t.toLocaleLowerCase(f.filterLocale).startsWith(J.current.toLocaleLowerCase(f.filterLocale)))},ue=function(e){return s.ObjectUtils.isNotEmpty(e)&&!(ze(e)||Xe(e))},se=function(){return s.ObjectUtils.isNotEmpty(f.value)},pe=function(e){return ue(e)&&He(e)},de=function(){return se?nt.findIndex((function(e){return pe(e)})):-1},fe=function(){var e=de();return e<0?ve():e},me=function(e,t){J.current=(J.current||"")+t;var n=-1,r=!1;return s.ObjectUtils.isNotEmpty(J.current)&&(-1!==(n=-1!==S?-1===(n=nt.slice(S).findIndex((function(e){return ce(e)})))?nt.slice(0,S).findIndex((function(e){return ce(e)})):n+S:nt.findIndex((function(e){return ce(e)})))&&(r=!0),-1===n&&-1===S&&(n=fe()),-1!==n&&ge(e,n)),_.current&&clearTimeout(_.current),_.current=setTimeout((function(){J.current="",_.current=null}),500),r},ve=function(){return nt.findIndex((function(e){return ue(e)}))},be=function(){return s.ObjectUtils.findLastIndex(nt,(function(e){return ue(e)}))},ge=function(e,t){S!==t&&(j(t),f.selectOnFocus&&ie(e,nt[t],!1))},he=function(e){if(N){var t=-1!==S?(r=(n=S)<nt.length-1?nt.slice(n+1).findIndex((function(e){return ue(e)})):-1)>-1?r+n+1:n:k.current?ve():fe();ge(e,t)}else Ge(),f.editable&&ge(e,de());var n,r;e.preventDefault()},ye=function(e){var t,n,r;if(e.altKey&&!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))-1!==S&&ie(e,nt[S]),state.overlayVisible&&Ae(),e.preventDefault();else{var o=-1!==S?(r=(n=S)>0?s.ObjectUtils.findLastIndex(nt.slice(0,n),(function(e){return ue(e)})):-1)>-1?r:n:k.current?be():(t=de())<0?be():t;ge(e,o),!N&&Ge(),e.preventDefault()}},we=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&j(-1)},Oe=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?(e.currentTarget.setSelectionRange(0,0),j(-1)):(ge(e,ve()),!N&&Ge()),e.preventDefault()},Ie=function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var t=e.currentTarget,n=t.value.length;t.setSelectionRange(n,n),j(-1)}else ge(e,be()),!N&&Ge();e.preventDefault()},Ee=function(e){e.preventDefault()},xe=function(e){e.preventDefault()},Se=function(e){!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&De(e)},De=function(e){N?(-1!==S&&ie(e,nt[S]),Ae()):(j(-1),he(e)),e.preventDefault()},je=function(e){N&&Ae(),e.preventDefault()},Fe=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]||(!N||s.DomHandler.getFocusableElements(R.current,':not([data-p-hidden-focusable="true"])').length>0?(-1!==S&&ie(e,nt[S]),N&&Ae()):(s.DomHandler.focus(T.current),e.preventDefault()))},Ne=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&!N&&Ge()},Ce=function(e){var t=null;e.target.value&&(t=nt.findIndex((function(t){return _e(t).toLocaleLowerCase().startsWith(e.target.value.toLocaleLowerCase())}))),j(t),f.onChange&&f.onChange({originalEvent:e.originalEvent,value:e.target.value,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:e.target.value}})},ke=function(e){y(!0),Ae(),f.onFocus&&f.onFocus(e)},Le=function(e){b(""),f.onFilter&&f.onFilter({filter:""}),e&&e()},Pe=function(e){f.onChange&&f.onChange({originalEvent:e,value:void 0,stopPropagation:function(){null==e||e.stopPropagation()},preventDefault:function(){null==e||e.preventDefault()},target:{name:f.name,id:f.id,value:void 0}}),f.filter&&Le(),Be()},Ue=function(e){if(rt!==e.option){Be(e.option),j(-1);var t=Je(e.option),n=Me(e.option,nt);f.onChange&&f.onChange({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:t}}),ge(e.originalEvent,n)}},Re=function(e){if(e=e||nt,null!=f.value&&e){if(!f.optionGroupLabel)return Me(f.value,e);for(var t=0;t<e.length;t++){var n=Me(f.value,qe(e[t]));if(-1!==n)return{group:t,option:n}}}return-1},Te=function(){return f.optionValue?null:f.dataKey},Me=function(e,t){var n=Te();return t.findIndex((function(t){return s.ObjectUtils.equals(e,Je(t),n)}))},He=function(e){return s.ObjectUtils.equals(f.value,Je(e),Te())},Ge=function(){j(-1!==S?S:f.autoOptionFocus?fe():f.editable?-1:de()),C(!0)},Ae=function(){C(!1),k.current=!1},Ve=function(){s.DomHandler.alignOverlay(R.current,A.current.parentElement,f.appendTo||d&&d.appendTo||O.default.appendTo)},Ke=function(){var e=s.DomHandler.findSingle(R.current,'li[data-p-focused="true"]');if(e&&e.scrollIntoView)e.scrollIntoView({block:"nearest",inline:"nearest"});else{var t=s.DomHandler.findSingle(R.current,'li[data-p-highlight="true"]');t&&t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"nearest"})}},Be=function(e){A.current&&(A.current.value=e?_e(e):f.value||"",V.current&&(V.current.value=A.current.value))},_e=function(e){return f.optionLabel?s.ObjectUtils.resolveFieldData(e,f.optionLabel):s.ObjectUtils.resolveFieldData(e,"label")||e},Je=function(e){return f.optionValue?s.ObjectUtils.resolveFieldData(e,f.optionValue):s.ObjectUtils.resolveFieldData(e,"value")||e},Xe=function(e){return f.optionGroupLabel&&e.optionGroup&&e.group},ze=function(e){return f.optionDisabled?s.ObjectUtils.isFunction(f.optionDisabled)?f.optionDisabled(e):s.ObjectUtils.resolveFieldData(e,f.optionDisabled):!(!e||void 0===e.disabled)&&e.disabled},qe=function(e){return s.ObjectUtils.resolveFieldData(e,f.optionGroupChildren)},Ze=function(){if(f.editable&&A.current){var e=(rt?_e(rt):null)||f.value||"";A.current.value=e,V.current&&(V.current.value=e)}};w.useImperativeHandle(t,(function(){return{props:f,show:Ge,hide:Ae,clear:Pe,focus:function(){return s.DomHandler.focus(V.current)},getElement:function(){return U.current},getOverlay:function(){return R.current},getInput:function(){return A.current},getFocusInput:function(){return V.current},getVirtualScroller:function(){return K.current}}})),w.useEffect((function(){s.ObjectUtils.combinedRefs(A,f.inputRef),s.ObjectUtils.combinedRefs(V,f.focusInputRef)}),[A,f.inputRef,V,f.focusInputRef]),o.useMountEffect((function(){f.autoFocus&&s.DomHandler.focus(V.current,f.autoFocus),Ve()})),o.useUpdateEffect((function(){N&&(f.value||S>=0)&&Ke()}),[N,f.value,S]),o.useUpdateEffect((function(){N&&v&&f.filter&&Ve()}),[N,v,f.filter]),o.useUpdateEffect((function(){!v||f.options&&0!==f.options.length||b(""),Ze(),A.current&&(A.current.selectedIndex=1)})),o.useUnmountEffect((function(){s.ZIndexUtils.clear(R.current)}));var We,$e,Ye,Qe,et,tt=function(e){"Enter"!==e.key&&"Space"!==e.code||(Pe(e),e.preventDefault())},nt=function(){var e=f.optionGroupLabel?ne(f.options):f.options;if(z&&!X){var t=v.trim().toLocaleLowerCase(f.filterLocale),r=f.filterBy?f.filterBy.split(","):[f.optionLabel||"label"];if(f.optionGroupLabel){var o,l=[],i=G(f.options);try{for(i.s();!(o=i.n()).done;){var a=o.value,c=n.FilterService.filter(qe(a),r,t,f.filterMatchMode,f.filterLocale);c&&c.length&&l.push(B(B({},a),D({},"".concat(f.optionGroupChildren),c)))}}catch(e){i.e(e)}finally{i.f()}return ne(l)}return n.FilterService.filter(e,r,t,f.filterMatchMode,f.filterLocale)}return e}(),rt=-1!==(We=Re(f.options))?f.optionGroupLabel?qe(f.options[We.group])[We.option]:f.options[We]:null,ot=s.ObjectUtils.isNotEmpty(f.tooltip),lt=P.getOtherProps(f),it=s.ObjectUtils.reduceKeys(lt,s.DomHandler.ARIA_PROPS),at=function(){var e={value:"",label:f.placeholder};if(rt){var t=Je(rt);e={value:"object"===E(t)?f.options.findIndex((function(e){return e===t})):t,label:_e(rt)}}var n=p({className:"p-hidden-accessible p-dropdown-hidden-select"},W("hiddenSelectedMessage")),r=p({ref:A,required:f.required,defaultValue:e.value,name:f.name,tabIndex:-1,"aria-hidden":"true"},W("select")),o=p({value:e.value},W("option"));return w.createElement("div",n,w.createElement("select",r,w.createElement("option",o,e.label)))}(),ct=function(){var e=s.ObjectUtils.isNotEmpty(rt)?_e(rt):null;f.editable&&(e=e||f.value||"");var t=p({className:"p-hidden-accessible"},W("hiddenSelectedMessage")),n=p(B({ref:V,id:f.inputId,defaultValue:e,type:"text",readOnly:!0,"aria-haspopup":"listbox",onFocus:oe,onBlur:le,onKeyDown:ae,disabled:f.disabled,tabIndex:f.disabled?-1:f.tabIndex||0},it),W("input"));return w.createElement("div",t,w.createElement("input",n))}(),ut=function(){var e=s.ObjectUtils.isNotEmpty(rt)?_e(rt):null;if(f.editable){var t=p(B({ref:A,type:"text",defaultValue:e||f.value||"",className:$("input",{label:e}),disabled:f.disabled,placeholder:f.placeholder,maxLength:f.maxLength,onInput:Ce,onFocus:ke,onKeyDown:ae,onBlur:le,tabIndex:f.disabled?-1:f.tabIndex||0,"aria-haspopup":"listbox"},it),W("input"));return w.createElement("input",t)}var n=f.valueTemplate?s.ObjectUtils.getJSXElement(f.valueTemplate,rt,f):e||f.placeholder||"empty",r=p({ref:A,className:$("input",{label:e}),tabIndex:"-1"},W("input"));return w.createElement("span",r,n)}(),st=f.loading?($e=p({className:$("loadingIcon"),"data-pr-overlay-visible":N},W("loadingIcon")),Ye=s.IconUtils.getJSXIcon(f.loadingIcon||w.createElement(i.SpinnerIcon,{spin:!0}),B({},$e),{props:f}),Qe=f.placeholder||f.ariaLabel,et=p({className:$("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":N,"aria-label":Qe},W("trigger")),w.createElement("div",et,Ye)):function(){var e=p({className:$("dropdownIcon"),"data-pr-overlay-visible":N},W("dropdownIcon")),t=s.IconUtils.getJSXIcon(f.dropdownIcon||w.createElement(l.ChevronDownIcon,e),B({},e),{props:f}),n=f.placeholder||f.ariaLabel,r=p({className:$("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":N,"aria-label":n},W("trigger"));return w.createElement("div",r,t)}(),pt=function(){if(null!=f.value&&f.showClear&&!f.disabled){var e=p({className:$("clearIcon"),onPointerUp:Pe,tabIndex:f.tabIndex||"0",onKeyDown:tt,"aria-label":n.localeOption("clear")},W("clearIcon"));return s.IconUtils.getJSXIcon(f.clearIcon||w.createElement(a.TimesIcon,e),B({},e),{props:f})}return null}(),dt=p({id:f.id,ref:U,className:s.classNames(f.className,$("root",{context:d,focusedState:h,overlayVisibleState:N})),style:f.style,onClick:function(e){return t=e,void(f.disabled||f.loading||(f.onClick&&f.onClick(t),t.defaultPrevented||re(t)||"INPUT"===t.target.tagName||(R.current&&R.current&&R.current.contains(t.target)||(s.DomHandler.focus(V.current),N?Ae():Ge()),k.current=!0)));var t},onMouseDown:f.onMouseDown,onContextMenu:f.onContextMenu,onFocus:function(){f.editable&&!N&&!1===k.current&&s.DomHandler.focus(A.current)},"data-p-disabled":f.disabled,"data-p-focus":h},lt,W("root")),ft=p({ref:T,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===V.current?s.DomHandler.getFirstFocusableElement(R.current,':not([data-p-hidden-focusable="true"])'):V.current;s.DomHandler.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},W("hiddenFirstFocusableEl")),mt=p({ref:M,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===V.current?s.DomHandler.getLastFocusableElement(R.current,':not([data-p-hidden-focusable="true"])'):V.current;s.DomHandler.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},W("hiddenLastFocusableEl"));return w.createElement(w.Fragment,null,w.createElement("div",dt,ct,at,ut,pt,st,w.createElement(H,I({hostName:"Dropdown",ref:R,visibleOptions:nt,virtualScrollerRef:K},f,{appendTo:q,cx:$,filterValue:v,focusedOptionIndex:S,getOptionGroupChildren:qe,getOptionGroupLabel:function(e){return s.ObjectUtils.resolveFieldData(e,f.optionGroupLabel)},getOptionGroupRenderKey:function(e){return s.ObjectUtils.resolveFieldData(e,f.optionGroupLabel)},getOptionLabel:_e,getOptionRenderKey:function(e){return f.dataKey?s.ObjectUtils.resolveFieldData(e,f.dataKey):_e(e)},getSelectedOptionIndex:Re,hasFilter:z,in:N,isOptionDisabled:ze,isSelected:He,onClick:function(e){c.OverlayService.emit("overlay-click",{originalEvent:e,target:U.current})},onEnter:function(e){s.ZIndexUtils.set("overlay",R.current,d&&d.autoZIndex||O.default.autoZIndex,d&&d.zIndex.overlay||O.default.zIndex.overlay),s.DomHandler.addStyles(R.current,{position:"absolute",top:"0",left:"0"}),Ve(),e&&e()},onEntered:function(e){e&&e(),ee(),f.onShow&&f.onShow()},onExit:function(){te()},onExited:function(){f.filter&&f.resetFilterOnHide&&Le(),s.ZIndexUtils.clear(R.current),f.onHide&&f.onHide()},onFilterClearIconClick:function(e){Le(e)},onFilterInputChange:function(e){var t=e.target.value;b(t),f.onFilter&&f.onFilter({originalEvent:e,filter:t})},onFilterInputKeyDown:function(e){switch(e.code){case"ArrowDown":he(e);break;case"ArrowUp":ye(e);break;case"ArrowLeft":case"ArrowRight":we(e,!0);break;case"Escape":case"Enter":case"NumpadEnter":De(e),e.preventDefault()}},onOptionClick:function(e){e.option.disabled||(Ue(e),s.DomHandler.focus(V.current)),Ae()},ptm:W,resetFilter:Le,changeFocusedOptionIndex:ge,firstFocusableElement:w.createElement("span",ft),lastFocusableElement:w.createElement("span",mt),sx:Y}))),ot&&w.createElement(u.Tooltip,I({target:U,content:f.tooltip,pt:W("tooltip")},f.tooltipOptions)))})));return _.displayName="Dropdown",e.Dropdown=_,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.componentbase,primereact.hooks,primereact.icons.chevrondown,primereact.icons.spinner,primereact.icons.times,primereact.overlayservice,primereact.tooltip,primereact.utils,primereact.csstransition,primereact.icons.search,primereact.portal,primereact.virtualscroller,primereact.ripple,primereact.icons.check,primereact.iconbase);
|
package/galleria/galleria.cjs.js
CHANGED
|
@@ -1082,6 +1082,13 @@ var Galleria = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespace
|
|
|
1082
1082
|
componentbase.useHandleStyle(GalleriaBase.css.styles, isUnstyled, {
|
|
1083
1083
|
name: 'galleria'
|
|
1084
1084
|
});
|
|
1085
|
+
hooks.useGlobalOnEscapeKey({
|
|
1086
|
+
callback: function callback() {
|
|
1087
|
+
hide();
|
|
1088
|
+
},
|
|
1089
|
+
when: props.closeOnEscape && props.fullScreen,
|
|
1090
|
+
priority: [hooks.ESC_KEY_HANDLING_PRIORITIES.IMAGE, 0]
|
|
1091
|
+
});
|
|
1085
1092
|
hooks.useInterval(function () {
|
|
1086
1093
|
onActiveItemChange({
|
|
1087
1094
|
index: props.circular && props.value.length - 1 === activeItemIndex ? 0 : activeItemIndex + 1
|