primereact 7.2.0 → 7.2.1
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/calendar/calendar.cjs.js +1 -1
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +1 -1
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +1 -1
- package/calendar/calendar.min.js +1 -1
- package/carousel/carousel.cjs.js +212 -5
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +212 -5
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +212 -5
- package/carousel/carousel.min.js +1 -1
- package/core/core.js +34 -3
- package/core/core.min.js +4 -4
- package/datatable/datatable.cjs.js +21 -16
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.d.ts +1 -0
- package/datatable/datatable.esm.js +21 -16
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +21 -16
- package/datatable/datatable.min.js +1 -1
- package/dataview/dataview.cjs.js +1 -5
- package/dataview/dataview.cjs.min.js +1 -1
- package/dataview/dataview.esm.js +1 -5
- package/dataview/dataview.esm.min.js +1 -1
- package/dataview/dataview.js +1 -5
- package/dataview/dataview.min.js +1 -1
- package/dropdown/dropdown.cjs.js +1 -1
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +1 -1
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +1 -1
- package/dropdown/dropdown.min.js +1 -1
- package/galleria/galleria.cjs.js +212 -5
- package/galleria/galleria.cjs.min.js +1 -1
- package/galleria/galleria.esm.js +212 -5
- package/galleria/galleria.esm.min.js +1 -1
- package/galleria/galleria.js +212 -5
- package/galleria/galleria.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +5 -1
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +5 -1
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +5 -1
- package/inputnumber/inputnumber.min.js +1 -1
- package/knob/knob.cjs.js +1 -1
- package/knob/knob.cjs.min.js +1 -1
- package/knob/knob.esm.js +1 -1
- package/knob/knob.esm.min.js +1 -1
- package/knob/knob.js +1 -1
- package/knob/knob.min.js +1 -1
- package/multiselect/multiselect.cjs.js +1 -1
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.esm.js +1 -1
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +1 -1
- package/multiselect/multiselect.min.js +1 -1
- package/package.json +1 -1
- package/primereact.all.cjs.js +142 -122
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +142 -122
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +142 -122
- package/primereact.all.min.js +1 -1
- package/resources/primereact.css +7 -2
- package/resources/primereact.min.css +1 -1
- package/resources/themes/arya-blue/theme.css +254 -2
- package/resources/themes/arya-green/theme.css +254 -2
- package/resources/themes/arya-orange/theme.css +254 -2
- package/resources/themes/arya-purple/theme.css +254 -2
- package/resources/themes/bootstrap4-dark-blue/theme.css +254 -2
- package/resources/themes/bootstrap4-dark-purple/theme.css +254 -2
- package/resources/themes/bootstrap4-light-blue/theme.css +252 -0
- package/resources/themes/bootstrap4-light-purple/theme.css +252 -0
- package/resources/themes/fluent-light/theme.css +252 -0
- package/resources/themes/lara-dark-blue/theme.css +261 -44
- package/resources/themes/lara-dark-indigo/theme.css +261 -44
- package/resources/themes/lara-dark-purple/theme.css +261 -44
- package/resources/themes/lara-dark-teal/theme.css +261 -44
- package/resources/themes/lara-light-blue/theme.css +259 -42
- package/resources/themes/lara-light-indigo/theme.css +259 -42
- package/resources/themes/lara-light-purple/theme.css +259 -42
- package/resources/themes/lara-light-teal/theme.css +259 -42
- package/resources/themes/luna-amber/theme.css +252 -0
- package/resources/themes/luna-blue/theme.css +252 -0
- package/resources/themes/luna-green/theme.css +252 -0
- package/resources/themes/luna-pink/theme.css +252 -0
- package/resources/themes/md-dark-deeppurple/theme.css +328 -2
- package/resources/themes/md-dark-indigo/theme.css +328 -2
- package/resources/themes/md-light-deeppurple/theme.css +326 -0
- package/resources/themes/md-light-indigo/theme.css +326 -0
- package/resources/themes/mdc-dark-deeppurple/theme.css +328 -2
- package/resources/themes/mdc-dark-indigo/theme.css +328 -2
- package/resources/themes/mdc-light-deeppurple/theme.css +326 -0
- package/resources/themes/mdc-light-indigo/theme.css +326 -0
- package/resources/themes/nova/theme.css +252 -0
- package/resources/themes/nova-accent/theme.css +252 -0
- package/resources/themes/nova-alt/theme.css +252 -0
- package/resources/themes/rhea/theme.css +252 -0
- package/resources/themes/saga-blue/theme.css +252 -0
- package/resources/themes/saga-green/theme.css +252 -0
- package/resources/themes/saga-orange/theme.css +252 -0
- package/resources/themes/saga-purple/theme.css +252 -0
- package/resources/themes/tailwind-light/theme.css +252 -0
- package/resources/themes/vela-blue/theme.css +254 -2
- package/resources/themes/vela-green/theme.css +254 -2
- package/resources/themes/vela-orange/theme.css +254 -2
- package/resources/themes/vela-purple/theme.css +254 -2
- package/splitbutton/splitbutton.d.ts +4 -1
- package/splitbutton/splitbutton.min.css +1 -1
- package/tabmenu/tabmenu.cjs.js +1 -1
- package/tabmenu/tabmenu.cjs.min.js +1 -1
- package/tabmenu/tabmenu.esm.js +1 -1
- package/tabmenu/tabmenu.esm.min.js +1 -1
- package/tabmenu/tabmenu.js +1 -1
- package/tabmenu/tabmenu.min.js +1 -1
- package/tabview/tabview.cjs.js +1 -1
- package/tabview/tabview.cjs.min.js +1 -1
- package/tabview/tabview.esm.js +1 -1
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +1 -1
- package/tabview/tabview.min.js +1 -1
- package/toolbar/toolbar.min.css +1 -1
- package/tree/tree.cjs.js +2 -1
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +2 -1
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +2 -1
- package/tree/tree.min.js +1 -1
- package/treeselect/treeselect.cjs.js +3 -3
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.esm.js +3 -3
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +3 -3
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/treetable.cjs.js +12 -10
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.esm.js +8 -7
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +12 -10
- package/treetable/treetable.min.js +1 -1
- package/utils/utils.cjs.js +26 -0
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.d.ts +1 -0
- package/utils/utils.esm.js +26 -0
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +26 -0
- package/utils/utils.min.js +1 -1
- package/web-types.json +15 -3
- package/resources/themes/lara-dark-blue/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-SemiBold.woff2 +0 -0
package/dropdown/dropdown.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.dropdown=function(e,t,n,i,r,o,l,s,a,p){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(t),h=u(s);function d(){return d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},d.apply(this,arguments)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function y(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function b(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function O(e,t){return O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},O(e,t)}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O(e,t)}function g(e){return g="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},g(e)}function k(e,t){if(t&&("object"===g(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return b(e)}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},C(e)}function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var E=function(e){m(l,e);var t,r,o=(t=l,r=w(),function(){var e,n=C(t);if(r){var i=C(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return k(this,e)});function l(e){var t;return f(this,l),(t=o.call(this,e)).onClick=t.onClick.bind(b(t)),t}return y(l,[{key:"onClick",value:function(e){this.props.onClick&&this.props.onClick({originalEvent:e,option:this.props.option})}},{key:"render",value:function(){var e=n.classNames("p-dropdown-item",{"p-highlight":this.props.selected,"p-disabled":this.props.disabled,"p-dropdown-item-empty":!this.props.label||0===this.props.label.length},this.props.option.className),t=this.props.template?n.ObjectUtils.getJSXElement(this.props.template,this.props.option):this.props.label;return c.default.createElement("li",{className:e,onClick:this.onClick,"aria-label":this.props.label,key:this.props.label,role:"option","aria-selected":this.props.selected},t,c.default.createElement(i.Ripple,null))}}]),l}(t.Component);function L(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?L(Object(n),!0).forEach((function(t){I(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function F(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}I(E,"defaultProps",{option:null,label:null,template:null,selected:!1,disabled:!1,onClick:null});var R=function(e){m(p,e);var t,i,a=(t=p,i=F(),function(){var e,n=C(t);if(i){var r=C(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return k(this,e)});function p(e){var t;return f(this,p),(t=a.call(this,e)).onEnter=t.onEnter.bind(b(t)),t.onEntered=t.onEntered.bind(b(t)),t.onFilterInputChange=t.onFilterInputChange.bind(b(t)),t}return y(p,[{key:"onEnter",value:function(){var e=this;this.props.onEnter((function(){if(e.virtualScrollerRef){var t=e.props.getSelectedOptionIndex();-1!==t&&e.virtualScrollerRef.scrollToIndex(t)}}))}},{key:"onEntered",value:function(){var e=this;this.props.onEntered((function(){e.props.filter&&e.props.filterInputAutoFocus&&e.filterInput.focus()}))}},{key:"onFilterInputChange",value:function(e){this.virtualScrollerRef&&this.virtualScrollerRef.scrollToIndex(0),this.props.onFilterInputChange&&this.props.onFilterInputChange(e)}},{key:"isEmptyFilter",value:function(){return!(this.props.visibleOptions&&this.props.visibleOptions.length)&&this.props.hasFilter()}},{key:"renderGroupChildren",value:function(e){var t=this;return this.props.getOptionGroupChildren(e).map((function(e,n){var i=t.props.getOptionLabel(e),r=n+"_"+t.props.getOptionRenderKey(e),o=t.props.isOptionDisabled(e);return c.default.createElement(E,{key:r,label:i,option:e,template:t.props.itemTemplate,selected:t.props.isSelected(e),disabled:o,onClick:t.props.onOptionClick})}))}},{key:"renderEmptyMessage",value:function(e,t){var i=n.ObjectUtils.getJSXElement(e,this.props)||s.localeOption(t?"emptyFilterMessage":"emptyMessage");return c.default.createElement("li",{className:"p-dropdown-empty-message"},i)}},{key:"renderItem",value:function(e,t){if(this.props.optionGroupLabel){var i=this.props.optionGroupTemplate?n.ObjectUtils.getJSXElement(this.props.optionGroupTemplate,e,t):this.props.getOptionGroupLabel(e),r=this.renderGroupChildren(e),o=t+"_"+this.props.getOptionGroupRenderKey(e);return c.default.createElement(c.default.Fragment,{key:o},c.default.createElement("li",{className:"p-dropdown-item-group"},i),r)}var l=this.props.getOptionLabel(e),s=t+"_"+this.props.getOptionRenderKey(e),a=this.props.isOptionDisabled(e);return c.default.createElement(E,{key:s,label:l,option:e,template:this.props.itemTemplate,selected:this.props.isSelected(e),disabled:a,onClick:this.props.onOptionClick})}},{key:"renderItems",value:function(){var e=this;return this.props.visibleOptions&&this.props.visibleOptions.length?this.props.visibleOptions.map((function(t,n){return e.renderItem(t,n)})):this.props.hasFilter()?this.renderEmptyMessage(this.props.emptyFilterMessage,!0):this.renderEmptyMessage(this.props.emptyMessage)}},{key:"renderFilterClearIcon",value:function(){var e=this;return this.props.showFilterClear&&this.props.filterValue?c.default.createElement("i",{className:"p-dropdown-filter-clear-icon pi pi-times",onClick:function(){return e.props.onFilterClearIconClick((function(){return e.filterInput.focus()}))}}):null}},{key:"renderFilter",value:function(){var e=this;if(this.props.filter){var t=this.renderFilterClearIcon(),i=n.classNames("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!t});return c.default.createElement("div",{className:"p-dropdown-header"},c.default.createElement("div",{className:i},c.default.createElement("input",{ref:function(t){return e.filterInput=t},type:"text",autoComplete:"off",className:"p-dropdown-filter p-inputtext p-component",placeholder:this.props.filterPlaceholder,onKeyDown:this.props.onFilterInputKeyDown,onChange:this.onFilterInputChange,value:this.props.filterValue}),t,c.default.createElement("i",{className:"p-dropdown-filter-icon pi pi-search"})))}return null}},{key:"renderContent",value:function(){var e=this;if(this.props.virtualScrollerOptions){var t=S(S({},this.props.virtualScrollerOptions),{style:S(S({},this.props.virtualScrollerOptions.style),{height:this.props.scrollHeight}),className:n.classNames("p-dropdown-items-wrapper",this.props.virtualScrollerOptions.className),items:this.props.visibleOptions,onLazyLoad:function(t){return e.props.virtualScrollerOptions.onLazyLoad(S(S({},t),{filter:e.props.filterValue}))},itemTemplate:function(t,n){return t&&e.renderItem(t,n.index)},contentTemplate:function(t){var i=n.classNames("p-dropdown-items",t.className),r=e.isEmptyFilter()?e.renderEmptyMessage():t.children;return c.default.createElement("ul",{ref:t.contentRef,className:i,role:"listbox"},r)}});return c.default.createElement(l.VirtualScroller,d({ref:function(t){return e.virtualScrollerRef=t}},t))}var i=this.renderItems();return c.default.createElement("div",{className:"p-dropdown-items-wrapper",style:{maxHeight:this.props.scrollHeight||"auto"}},c.default.createElement("ul",{className:"p-dropdown-items",role:"listbox"},i))}},{key:"renderElement",value:function(){var e=n.classNames("p-dropdown-panel p-component",this.props.panelClassName),t=this.renderFilter(),i=this.renderContent();return c.default.createElement(r.CSSTransition,{nodeRef:this.props.forwardRef,classNames:"p-connected-overlay",in:this.props.in,timeout:{enter:120,exit:100},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntering:this.props.onEntering,onEntered:this.onEntered,onExit:this.props.onExit,onExited:this.props.onExited},c.default.createElement("div",{ref:this.props.forwardRef,className:e,style:this.props.panelStyle,onClick:this.props.onClick},t,i))}},{key:"render",value:function(){var e=this.renderElement();return c.default.createElement(o.Portal,{element:e,appendTo:this.props.appendTo})}}]),p}(t.Component),x=c.default.forwardRef((function(e,t){return c.default.createElement(R,d({forwardRef:t},e))}));function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach((function(t){I(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function V(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=P(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw o}}}}function P(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 N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function G(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var K=function(e){m(l,e);var i,r,o=(i=l,r=G(),function(){var e,t=C(i);if(r){var n=C(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return k(this,e)});function l(e){var n;return f(this,l),(n=o.call(this,e)).state={filter:"",focused:!1,overlayVisible:!1},n.onClick=n.onClick.bind(b(n)),n.onInputFocus=n.onInputFocus.bind(b(n)),n.onInputBlur=n.onInputBlur.bind(b(n)),n.onInputKeyDown=n.onInputKeyDown.bind(b(n)),n.onEditableInputChange=n.onEditableInputChange.bind(b(n)),n.onEditableInputFocus=n.onEditableInputFocus.bind(b(n)),n.onOptionClick=n.onOptionClick.bind(b(n)),n.onFilterInputChange=n.onFilterInputChange.bind(b(n)),n.onFilterInputKeyDown=n.onFilterInputKeyDown.bind(b(n)),n.onFilterClearIconClick=n.onFilterClearIconClick.bind(b(n)),n.onPanelClick=n.onPanelClick.bind(b(n)),n.onOverlayEnter=n.onOverlayEnter.bind(b(n)),n.onOverlayEntered=n.onOverlayEntered.bind(b(n)),n.onOverlayExit=n.onOverlayExit.bind(b(n)),n.onOverlayExited=n.onOverlayExited.bind(b(n)),n.resetFilter=n.resetFilter.bind(b(n)),n.clear=n.clear.bind(b(n)),n.hasFilter=n.hasFilter.bind(b(n)),n.getOptionLabel=n.getOptionLabel.bind(b(n)),n.getOptionRenderKey=n.getOptionRenderKey.bind(b(n)),n.isOptionDisabled=n.isOptionDisabled.bind(b(n)),n.getOptionGroupChildren=n.getOptionGroupChildren.bind(b(n)),n.getOptionGroupLabel=n.getOptionGroupLabel.bind(b(n)),n.getOptionGroupRenderKey=n.getOptionGroupRenderKey.bind(b(n)),n.getSelectedOptionIndex=n.getSelectedOptionIndex.bind(b(n)),n.isSelected=n.isSelected.bind(b(n)),n.overlayRef=t.createRef(),n.inputRef=t.createRef(n.props.inputRef),n}return y(l,[{key:"onClick",value:function(e){this.props.disabled||n.DomHandler.hasClass(e.target,"p-dropdown-clear-icon")||"INPUT"===e.target.tagName||this.overlayRef.current&&this.overlayRef.current&&this.overlayRef.current.contains(e.target)||(this.focusInput.focus(),this.state.overlayVisible?this.hideOverlay():this.showOverlay())}},{key:"onInputFocus",value:function(e){var t=this;e.persist(),this.props.showOnFocus&&!this.state.overlayVisible&&this.showOverlay(),this.setState({focused:!0},(function(){t.props.onFocus&&t.props.onFocus(e)}))}},{key:"onInputBlur",value:function(e){var t=this;e.persist(),this.setState({focused:!1},(function(){t.props.onBlur&&t.props.onBlur(e)}))}},{key:"onPanelClick",value:function(e){p.OverlayService.emit("overlay-click",{originalEvent:e,target:this.container})}},{key:"onInputKeyDown",value:function(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.state.overlayVisible?this.hideOverlay():this.showOverlay(),e.preventDefault();break;case 13:this.hideOverlay(),e.preventDefault();break;case 27:case 9:this.hideOverlay();break;default:this.search(e)}}},{key:"onFilterInputKeyDown",value:function(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.hideOverlay(),e.preventDefault()}}},{key:"onUpKey",value:function(e){if(this.getVisibleOptions()){var t=this.findPrevOption(this.getSelectedOptionIndex());t&&this.selectItem({originalEvent:e,option:t})}e.preventDefault()}},{key:"onDownKey",value:function(e){if(this.getVisibleOptions())if(!this.state.overlayVisible&&e.altKey)this.showOverlay();else{var t=this.findNextOption(this.getSelectedOptionIndex());t&&this.selectItem({originalEvent:e,option:t})}e.preventDefault()}},{key:"findNextOption",value:function(e){var t=this.getVisibleOptions();if(this.props.optionGroupLabel){var n=-1===e?0:e.group,i=-1===e?-1:e.option,r=this.findNextOptionInList(this.getOptionGroupChildren(t[n]),i);return r||(n+1!==t.length?this.findNextOption({group:n+1,option:-1}):null)}return this.findNextOptionInList(t,e)}},{key:"findNextOptionInList",value:function(e,t){var n=t+1;if(n===e.length)return null;var i=e[n];return this.isOptionDisabled(i)?this.findNextOptionInList(n):i}},{key:"findPrevOption",value:function(e){if(-1===e)return null;var t=this.getVisibleOptions();if(this.props.optionGroupLabel){var n=e.group,i=e.option,r=this.findPrevOptionInList(this.getOptionGroupChildren(t[n]),i);return r||(n>0?this.findPrevOption({group:n-1,option:this.getOptionGroupChildren(t[n-1]).length}):null)}return this.findPrevOptionInList(t,e)}},{key:"findPrevOptionInList",value:function(e,t){var n=t-1;if(n<0)return null;var i=e[n];return this.isOptionDisabled(i)?this.findPrevOption(n):i}},{key:"search",value:function(e){var t=this;this.searchTimeout&&clearTimeout(this.searchTimeout);var n=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=n,this.searchValue=this.previousSearchChar===this.currentSearchChar?this.currentSearchChar:this.searchValue?this.searchValue+n:n,this.searchValue){var i=this.getSelectedOptionIndex(),r=this.props.optionGroupLabel?this.searchOptionInGroup(i):this.searchOption(++i);r&&(this.selectItem({originalEvent:e,option:r}),this.selectedOptionUpdated=!0)}this.searchTimeout=setTimeout((function(){t.searchValue=null}),250)}},{key:"searchOption",value:function(e){var t;if(this.searchValue){var n=this.getVisibleOptions();(t=this.searchOptionInRange(e,n.length))||(t=this.searchOptionInRange(0,e))}return t}},{key:"searchOptionInRange",value:function(e,t){for(var n=this.getVisibleOptions(),i=e;i<t;i++){var r=n[i];if(this.matchesSearchValue(r))return r}return null}},{key:"searchOptionInGroup",value:function(e){for(var t=-1===e?{group:0,option:-1}:e,n=this.getVisibleOptions(),i=t.group;i<n.length;i++)for(var r=this.getOptionGroupChildren(n[i]),o=t.group===i?t.option+1:0;o<r.length;o++)if(this.matchesSearchValue(r[o]))return r[o];for(var l=0;l<=t.group;l++)for(var s=this.getOptionGroupChildren(n[l]),a=0;a<(t.group===l?t.option:s.length);a++)if(this.matchesSearchValue(s[a]))return s[a];return null}},{key:"matchesSearchValue",value:function(e){return this.getOptionLabel(e).toLocaleLowerCase(this.props.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.props.filterLocale))}},{key:"onEditableInputChange",value:function(e){this.props.onChange&&this.props.onChange({originalEvent:e.originalEvent,value:e.target.value,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:e.target.value}})}},{key:"onEditableInputFocus",value:function(e){var t=this;e.persist(),this.setState({focused:!0},(function(){t.hideOverlay(),t.props.onFocus&&t.props.onFocus(e)}))}},{key:"onOptionClick",value:function(e){e.option.disabled||(this.selectItem(e),this.focusInput.focus()),this.hideOverlay()}},{key:"onFilterInputChange",value:function(e){var t=this,n=e.target.value;this.setState({filter:n},(function(){t.props.onFilter&&t.props.onFilter({originalEvent:e,filter:n})}))}},{key:"onFilterClearIconClick",value:function(e){this.resetFilter(e)}},{key:"resetFilter",value:function(e){var t=this;this.setState({filter:""},(function(){t.props.onFilter&&t.props.onFilter({filter:""}),e&&e()}))}},{key:"clear",value:function(e){this.props.onChange&&this.props.onChange({originalEvent:e,value:void 0,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:void 0}}),this.updateEditableLabel()}},{key:"selectItem",value:function(e){if(this.getSelectedOption()!==e.option){this.updateEditableLabel(e.option);var t=this.getOptionValue(e.option);this.props.onChange&&this.props.onChange({originalEvent:e.originalEvent,value:t,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:t}})}}},{key:"getSelectedOption",value:function(){var e=this.getSelectedOptionIndex(),t=this.getVisibleOptions();return-1!==e?this.props.optionGroupLabel?this.getOptionGroupChildren(t[e.group])[e.option]:t[e]:null}},{key:"getSelectedOptionIndex",value:function(){var e=this.getVisibleOptions();if(null!=this.props.value&&e){if(!this.props.optionGroupLabel)return this.findOptionIndexInList(this.props.value,e);for(var t=0;t<e.length;t++){var n=this.findOptionIndexInList(this.props.value,this.getOptionGroupChildren(e[t]));if(-1!==n)return{group:t,option:n}}}return-1}},{key:"findOptionIndexInList",value:function(e,t){for(var i=this.equalityKey(),r=0;r<t.length;r++)if(n.ObjectUtils.equals(e,this.getOptionValue(t[r]),i))return r;return-1}},{key:"isSelected",value:function(e){return n.ObjectUtils.equals(this.props.value,this.getOptionValue(e),this.equalityKey())}},{key:"equalityKey",value:function(){return this.props.optionValue?null:this.props.dataKey}},{key:"showOverlay",value:function(){this.setState({overlayVisible:!0})}},{key:"hideOverlay",value:function(){this.setState({overlayVisible:!1})}},{key:"onOverlayEnter",value:function(e){n.ZIndexUtils.set("overlay",this.overlayRef.current,h.default.autoZIndex,h.default.zIndex.overlay),this.alignOverlay(),e&&e()}},{key:"onOverlayEntered",value:function(e){e&&e(),this.bindDocumentClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.props.onShow&&this.props.onShow()}},{key:"onOverlayExit",value:function(){this.unbindDocumentClickListener(),this.unbindScrollListener(),this.unbindResizeListener()}},{key:"onOverlayExited",value:function(){this.props.filter&&this.props.resetFilterOnHide&&this.resetFilter(),n.ZIndexUtils.clear(this.overlayRef.current),this.props.onHide&&this.props.onHide()}},{key:"alignOverlay",value:function(){n.DomHandler.alignOverlay(this.overlayRef.current,this.input.parentElement,this.props.appendTo||h.default.appendTo)}},{key:"scrollInView",value:function(){var e=n.DomHandler.findSingle(this.overlayRef.current,"li.p-highlight");e&&e.scrollIntoView({block:"nearest",inline:"start"})}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){e.state.overlayVisible&&e.isOutsideClicked(t)&&e.hideOverlay()},document.addEventListener("click",this.documentClickListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new n.ConnectedOverlayScrollHandler(this.container,(function(){e.state.overlayVisible&&e.hideOverlay()}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"bindResizeListener",value:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.state.overlayVisible&&!n.DomHandler.isTouchDevice()&&e.hideOverlay()},window.addEventListener("resize",this.resizeListener))}},{key:"unbindResizeListener",value:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)}},{key:"isOutsideClicked",value:function(e){return this.container&&!(this.container.isSameNode(e.target)||this.isClearClicked(e)||this.container.contains(e.target)||this.overlayRef&&this.overlayRef.current.contains(e.target))}},{key:"isClearClicked",value:function(e){return n.DomHandler.hasClass(e.target,"p-dropdown-clear-icon")||n.DomHandler.hasClass(e.target,"p-dropdown-filter-clear-icon")}},{key:"updateEditableLabel",value:function(e){this.input&&(this.input.value=e?this.getOptionLabel(e):this.props.value||"")}},{key:"hasFilter",value:function(){return this.state.filter&&this.state.filter.trim().length>0}},{key:"getOptionLabel",value:function(e){return this.props.optionLabel?n.ObjectUtils.resolveFieldData(e,this.props.optionLabel):e&&void 0!==e.label?e.label:e}},{key:"getOptionValue",value:function(e){return this.props.optionValue?n.ObjectUtils.resolveFieldData(e,this.props.optionValue):e&&void 0!==e.value?e.value:e}},{key:"getOptionRenderKey",value:function(e){return this.props.dataKey?n.ObjectUtils.resolveFieldData(e,this.props.dataKey):this.getOptionLabel(e)}},{key:"isOptionDisabled",value:function(e){return this.props.optionDisabled?n.ObjectUtils.isFunction(this.props.optionDisabled)?this.props.optionDisabled(e):n.ObjectUtils.resolveFieldData(e,this.props.optionDisabled):!(!e||void 0===e.disabled)&&e.disabled}},{key:"getOptionGroupRenderKey",value:function(e){return n.ObjectUtils.resolveFieldData(e,this.props.optionGroupLabel)}},{key:"getOptionGroupLabel",value:function(e){return n.ObjectUtils.resolveFieldData(e,this.props.optionGroupLabel)}},{key:"getOptionGroupChildren",value:function(e){return n.ObjectUtils.resolveFieldData(e,this.props.optionGroupChildren)}},{key:"checkValidity",value:function(){return!!this.inputRef.current&&this.inputRef.current.checkValidity()}},{key:"isLazy",value:function(){return this.props.virtualScrollerOptions&&this.props.virtualScrollerOptions.lazy}},{key:"getVisibleOptions",value:function(){if(this.hasFilter()&&!this.isLazy()){var e=this.state.filter.trim().toLocaleLowerCase(this.props.filterLocale),t=this.props.filterBy?this.props.filterBy.split(","):[this.props.optionLabel||"label"];if(this.props.optionGroupLabel){var n,i=[],r=V(this.props.options);try{for(r.s();!(n=r.n()).done;){var o=n.value,l=s.FilterService.filter(this.getOptionGroupChildren(o),t,e,this.props.filterMatchMode,this.props.filterLocale);l&&l.length&&i.push(j(j({},o),{items:l}))}}catch(e){r.e(e)}finally{r.f()}return i}return s.FilterService.filter(this.props.options,t,e,this.props.filterMatchMode,this.props.filterLocale)}return this.props.options}},{key:"updateInputField",value:function(){if(this.props.editable&&this.input){var e=this.getSelectedOption(),t=e?this.getOptionLabel(e):null;this.input.value=t||this.props.value||""}}},{key:"updateInputRef",value:function(){var e=this.props.inputRef;e&&("function"==typeof e?e(this.inputRef.current):e.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.props.autoFocus&&this.focusInput&&this.focusInput.focus(),this.props.tooltip&&this.renderTooltip(),this.updateInputField(),this.inputRef.current&&(this.inputRef.current.selectedIndex=1)}},{key:"componentWillUnmount",value:function(){this.unbindDocumentClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.tooltip&&(this.tooltip.destroy(),this.tooltip=null),this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),n.ZIndexUtils.clear(this.overlayRef.current)}},{key:"componentDidUpdate",value:function(e){this.state.overlayVisible&&(this.props.filter&&this.alignOverlay(),e.value!==this.props.value&&this.scrollInView()),e.tooltip===this.props.tooltip&&e.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(j({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),!this.state.filter||this.props.options&&0!==this.props.options.length||this.setState({filter:""}),this.updateInputField(),this.inputRef.current&&(this.inputRef.current.selectedIndex=1)}},{key:"renderHiddenSelect",value:function(e){var t=c.default.createElement("option",{value:""},this.props.placeholder),n=e?c.default.createElement("option",{value:e.value},this.getOptionLabel(e)):null;return c.default.createElement("div",{className:"p-hidden-accessible p-dropdown-hidden-select"},c.default.createElement("select",{ref:this.inputRef,required:this.props.required,name:this.props.name,tabIndex:-1,"aria-hidden":"true"},t,n))}},{key:"renderTooltip",value:function(){this.tooltip=a.tip({target:this.container,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"renderKeyboardHelper",value:function(){var e=this;return c.default.createElement("div",{className:"p-hidden-accessible"},c.default.createElement("input",{ref:function(t){return e.focusInput=t},id:this.props.inputId,type:"text",readOnly:!0,"aria-haspopup":"listbox",onFocus:this.onInputFocus,onBlur:this.onInputBlur,onKeyDown:this.onInputKeyDown,disabled:this.props.disabled,tabIndex:this.props.tabIndex,"aria-label":this.props.ariaLabel,"aria-labelledby":this.props.ariaLabelledBy}))}},{key:"renderLabel",value:function(e){var t=this,i=n.ObjectUtils.isNotEmpty(e)?this.getOptionLabel(e):null;if(this.props.editable)return c.default.createElement("input",{ref:function(e){return t.input=e},type:"text",defaultValue:i||this.props.value||"",className:"p-dropdown-label p-inputtext",disabled:this.props.disabled,placeholder:this.props.placeholder,maxLength:this.props.maxLength,onInput:this.onEditableInputChange,onFocus:this.onEditableInputFocus,onBlur:this.onInputBlur,"aria-label":this.props.ariaLabel,"aria-labelledby":this.props.ariaLabelledBy,"aria-haspopup":"listbox"});var r=n.classNames("p-dropdown-label p-inputtext",{"p-placeholder":null===i&&this.props.placeholder,"p-dropdown-label-empty":null===i&&!this.props.placeholder}),o=this.props.valueTemplate?n.ObjectUtils.getJSXElement(this.props.valueTemplate,e,this.props):i||this.props.placeholder||"empty";return c.default.createElement("span",{ref:function(e){return t.input=e},className:r},o)}},{key:"renderClearIcon",value:function(){return null!=this.props.value&&this.props.showClear&&!this.props.disabled?c.default.createElement("i",{className:"p-dropdown-clear-icon pi pi-times",onClick:this.clear}):null}},{key:"renderDropdownIcon",value:function(){var e=this,t=n.classNames("p-dropdown-trigger-icon p-clickable",this.props.dropdownIcon);return c.default.createElement("div",{ref:function(t){return e.trigger=t},className:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":this.state.overlayVisible},c.default.createElement("span",{className:t}))}},{key:"render",value:function(){var e=this,t=n.classNames("p-dropdown p-component p-inputwrapper",this.props.className,{"p-disabled":this.props.disabled,"p-focus":this.state.focused,"p-dropdown-clearable":this.props.showClear&&!this.props.disabled,"p-inputwrapper-filled":this.props.value,"p-inputwrapper-focus":this.state.focused||this.state.overlayVisible}),i=this.getVisibleOptions(),r=this.getSelectedOption(),o=this.props.appendTo||h.default.appendTo,l=this.renderHiddenSelect(r),s=this.renderKeyboardHelper(),a=this.renderLabel(r),p=this.renderDropdownIcon(),u=this.renderClearIcon();return c.default.createElement("div",{id:this.props.id,ref:function(t){return e.container=t},className:t,style:this.props.style,onClick:this.onClick,onMouseDown:this.props.onMouseDown,onContextMenu:this.props.onContextMenu},s,l,a,u,p,c.default.createElement(x,d({ref:this.overlayRef,visibleOptions:i},this.props,{appendTo:o,onClick:this.onPanelClick,onOptionClick:this.onOptionClick,filterValue:this.state.filter,hasFilter:this.hasFilter,onFilterClearIconClick:this.onFilterClearIconClick,onFilterInputKeyDown:this.onFilterInputKeyDown,onFilterInputChange:this.onFilterInputChange,getOptionLabel:this.getOptionLabel,getOptionRenderKey:this.getOptionRenderKey,isOptionDisabled:this.isOptionDisabled,getOptionGroupChildren:this.getOptionGroupChildren,getOptionGroupLabel:this.getOptionGroupLabel,getOptionGroupRenderKey:this.getOptionGroupRenderKey,isSelected:this.isSelected,getSelectedOptionIndex:this.getSelectedOptionIndex,in:this.state.overlayVisible,onEnter:this.onOverlayEnter,onEntered:this.onOverlayEntered,onExit:this.onOverlayExit,onExited:this.onOverlayExited})))}}]),l}(t.Component);return I(K,"defaultProps",{id:null,inputRef:null,name:null,value:null,options:null,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,optionGroupTemplate:null,valueTemplate:null,itemTemplate:null,style:null,className:null,virtualScrollerOptions:null,scrollHeight:"200px",filter:!1,filterBy:null,filterMatchMode:"contains",filterPlaceholder:null,filterLocale:void 0,emptyMessage:null,emptyFilterMessage:null,editable:!1,placeholder:null,required:!1,disabled:!1,appendTo:null,tabIndex:null,autoFocus:!1,filterInputAutoFocus:!0,resetFilterOnHide:!1,showFilterClear:!1,panelClassName:null,panelStyle:null,dataKey:null,inputId:null,showClear:!1,maxLength:null,tooltip:null,tooltipOptions:null,ariaLabel:null,ariaLabelledBy:null,transitionOptions:null,dropdownIcon:"pi pi-chevron-down",showOnFocus:!1,onChange:null,onFocus:null,onBlur:null,onMouseDown:null,onContextMenu:null,onShow:null,onHide:null,onFilter:null}),e.Dropdown=K,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils,primereact.ripple,primereact.csstransition,primereact.portal,primereact.virtualscroller,primereact.api,primereact.tooltip,primereact.overlayservice);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.dropdown=function(e,t,n,i,r,o,l,s,a,p){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(t),h=u(s);function d(){return d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},d.apply(this,arguments)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function y(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function b(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function O(e,t){return O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},O(e,t)}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O(e,t)}function g(e){return g="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},g(e)}function k(e,t){if(t&&("object"===g(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return b(e)}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},C(e)}function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var E=function(e){m(l,e);var t,r,o=(t=l,r=w(),function(){var e,n=C(t);if(r){var i=C(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return k(this,e)});function l(e){var t;return f(this,l),(t=o.call(this,e)).onClick=t.onClick.bind(b(t)),t}return y(l,[{key:"onClick",value:function(e){this.props.onClick&&this.props.onClick({originalEvent:e,option:this.props.option})}},{key:"render",value:function(){var e=n.classNames("p-dropdown-item",{"p-highlight":this.props.selected,"p-disabled":this.props.disabled,"p-dropdown-item-empty":!this.props.label||0===this.props.label.length},this.props.option.className),t=this.props.template?n.ObjectUtils.getJSXElement(this.props.template,this.props.option):this.props.label;return c.default.createElement("li",{className:e,onClick:this.onClick,"aria-label":this.props.label,key:this.props.label,role:"option","aria-selected":this.props.selected},t,c.default.createElement(i.Ripple,null))}}]),l}(t.Component);function L(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?L(Object(n),!0).forEach((function(t){I(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function F(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}I(E,"defaultProps",{option:null,label:null,template:null,selected:!1,disabled:!1,onClick:null});var R=function(e){m(p,e);var t,i,a=(t=p,i=F(),function(){var e,n=C(t);if(i){var r=C(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return k(this,e)});function p(e){var t;return f(this,p),(t=a.call(this,e)).onEnter=t.onEnter.bind(b(t)),t.onEntered=t.onEntered.bind(b(t)),t.onFilterInputChange=t.onFilterInputChange.bind(b(t)),t}return y(p,[{key:"onEnter",value:function(){var e=this;this.props.onEnter((function(){if(e.virtualScrollerRef){var t=e.props.getSelectedOptionIndex();-1!==t&&e.virtualScrollerRef.scrollToIndex(t)}}))}},{key:"onEntered",value:function(){var e=this;this.props.onEntered((function(){e.props.filter&&e.props.filterInputAutoFocus&&e.filterInput.focus()}))}},{key:"onFilterInputChange",value:function(e){this.virtualScrollerRef&&this.virtualScrollerRef.scrollToIndex(0),this.props.onFilterInputChange&&this.props.onFilterInputChange(e)}},{key:"isEmptyFilter",value:function(){return!(this.props.visibleOptions&&this.props.visibleOptions.length)&&this.props.hasFilter()}},{key:"renderGroupChildren",value:function(e){var t=this;return this.props.getOptionGroupChildren(e).map((function(e,n){var i=t.props.getOptionLabel(e),r=n+"_"+t.props.getOptionRenderKey(e),o=t.props.isOptionDisabled(e);return c.default.createElement(E,{key:r,label:i,option:e,template:t.props.itemTemplate,selected:t.props.isSelected(e),disabled:o,onClick:t.props.onOptionClick})}))}},{key:"renderEmptyMessage",value:function(e,t){var i=n.ObjectUtils.getJSXElement(e,this.props)||s.localeOption(t?"emptyFilterMessage":"emptyMessage");return c.default.createElement("li",{className:"p-dropdown-empty-message"},i)}},{key:"renderItem",value:function(e,t){if(this.props.optionGroupLabel){var i=this.props.optionGroupTemplate?n.ObjectUtils.getJSXElement(this.props.optionGroupTemplate,e,t):this.props.getOptionGroupLabel(e),r=this.renderGroupChildren(e),o=t+"_"+this.props.getOptionGroupRenderKey(e);return c.default.createElement(c.default.Fragment,{key:o},c.default.createElement("li",{className:"p-dropdown-item-group"},i),r)}var l=this.props.getOptionLabel(e),s=t+"_"+this.props.getOptionRenderKey(e),a=this.props.isOptionDisabled(e);return c.default.createElement(E,{key:s,label:l,option:e,template:this.props.itemTemplate,selected:this.props.isSelected(e),disabled:a,onClick:this.props.onOptionClick})}},{key:"renderItems",value:function(){var e=this;return this.props.visibleOptions&&this.props.visibleOptions.length?this.props.visibleOptions.map((function(t,n){return e.renderItem(t,n)})):this.props.hasFilter()?this.renderEmptyMessage(this.props.emptyFilterMessage,!0):this.renderEmptyMessage(this.props.emptyMessage)}},{key:"renderFilterClearIcon",value:function(){var e=this;return this.props.showFilterClear&&this.props.filterValue?c.default.createElement("i",{className:"p-dropdown-filter-clear-icon pi pi-times",onClick:function(){return e.props.onFilterClearIconClick((function(){return e.filterInput.focus()}))}}):null}},{key:"renderFilter",value:function(){var e=this;if(this.props.filter){var t=this.renderFilterClearIcon(),i=n.classNames("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!t});return c.default.createElement("div",{className:"p-dropdown-header"},c.default.createElement("div",{className:i},c.default.createElement("input",{ref:function(t){return e.filterInput=t},type:"text",autoComplete:"off",className:"p-dropdown-filter p-inputtext p-component",placeholder:this.props.filterPlaceholder,onKeyDown:this.props.onFilterInputKeyDown,onChange:this.onFilterInputChange,value:this.props.filterValue}),t,c.default.createElement("i",{className:"p-dropdown-filter-icon pi pi-search"})))}return null}},{key:"renderContent",value:function(){var e=this;if(this.props.virtualScrollerOptions){var t=S(S({},this.props.virtualScrollerOptions),{style:S(S({},this.props.virtualScrollerOptions.style),{height:this.props.scrollHeight}),className:n.classNames("p-dropdown-items-wrapper",this.props.virtualScrollerOptions.className),items:this.props.visibleOptions,onLazyLoad:function(t){return e.props.virtualScrollerOptions.onLazyLoad(S(S({},t),{filter:e.props.filterValue}))},itemTemplate:function(t,n){return t&&e.renderItem(t,n.index)},contentTemplate:function(t){var i=n.classNames("p-dropdown-items",t.className),r=e.isEmptyFilter()?e.renderEmptyMessage():t.children;return c.default.createElement("ul",{ref:t.contentRef,className:i,role:"listbox"},r)}});return c.default.createElement(l.VirtualScroller,d({ref:function(t){return e.virtualScrollerRef=t}},t))}var i=this.renderItems();return c.default.createElement("div",{className:"p-dropdown-items-wrapper",style:{maxHeight:this.props.scrollHeight||"auto"}},c.default.createElement("ul",{className:"p-dropdown-items",role:"listbox"},i))}},{key:"renderElement",value:function(){var e=n.classNames("p-dropdown-panel p-component",this.props.panelClassName),t=this.renderFilter(),i=this.renderContent();return c.default.createElement(r.CSSTransition,{nodeRef:this.props.forwardRef,classNames:"p-connected-overlay",in:this.props.in,timeout:{enter:120,exit:100},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntering:this.props.onEntering,onEntered:this.onEntered,onExit:this.props.onExit,onExited:this.props.onExited},c.default.createElement("div",{ref:this.props.forwardRef,className:e,style:this.props.panelStyle,onClick:this.props.onClick},t,i))}},{key:"render",value:function(){var e=this.renderElement();return c.default.createElement(o.Portal,{element:e,appendTo:this.props.appendTo})}}]),p}(t.Component),x=c.default.forwardRef((function(e,t){return c.default.createElement(R,d({forwardRef:t},e))}));function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach((function(t){I(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=P(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){s=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(s)throw o}}}}function P(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 N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function G(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var K=function(e){m(l,e);var i,r,o=(i=l,r=G(),function(){var e,t=C(i);if(r){var n=C(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return k(this,e)});function l(e){var n;return f(this,l),(n=o.call(this,e)).state={filter:"",focused:!1,overlayVisible:!1},n.onClick=n.onClick.bind(b(n)),n.onInputFocus=n.onInputFocus.bind(b(n)),n.onInputBlur=n.onInputBlur.bind(b(n)),n.onInputKeyDown=n.onInputKeyDown.bind(b(n)),n.onEditableInputChange=n.onEditableInputChange.bind(b(n)),n.onEditableInputFocus=n.onEditableInputFocus.bind(b(n)),n.onOptionClick=n.onOptionClick.bind(b(n)),n.onFilterInputChange=n.onFilterInputChange.bind(b(n)),n.onFilterInputKeyDown=n.onFilterInputKeyDown.bind(b(n)),n.onFilterClearIconClick=n.onFilterClearIconClick.bind(b(n)),n.onPanelClick=n.onPanelClick.bind(b(n)),n.onOverlayEnter=n.onOverlayEnter.bind(b(n)),n.onOverlayEntered=n.onOverlayEntered.bind(b(n)),n.onOverlayExit=n.onOverlayExit.bind(b(n)),n.onOverlayExited=n.onOverlayExited.bind(b(n)),n.resetFilter=n.resetFilter.bind(b(n)),n.clear=n.clear.bind(b(n)),n.hasFilter=n.hasFilter.bind(b(n)),n.getOptionLabel=n.getOptionLabel.bind(b(n)),n.getOptionRenderKey=n.getOptionRenderKey.bind(b(n)),n.isOptionDisabled=n.isOptionDisabled.bind(b(n)),n.getOptionGroupChildren=n.getOptionGroupChildren.bind(b(n)),n.getOptionGroupLabel=n.getOptionGroupLabel.bind(b(n)),n.getOptionGroupRenderKey=n.getOptionGroupRenderKey.bind(b(n)),n.getSelectedOptionIndex=n.getSelectedOptionIndex.bind(b(n)),n.isSelected=n.isSelected.bind(b(n)),n.overlayRef=t.createRef(),n.inputRef=t.createRef(n.props.inputRef),n}return y(l,[{key:"onClick",value:function(e){this.props.disabled||n.DomHandler.hasClass(e.target,"p-dropdown-clear-icon")||"INPUT"===e.target.tagName||this.overlayRef.current&&this.overlayRef.current&&this.overlayRef.current.contains(e.target)||(this.focusInput.focus(),this.state.overlayVisible?this.hideOverlay():this.showOverlay())}},{key:"onInputFocus",value:function(e){var t=this;e.persist(),this.props.showOnFocus&&!this.state.overlayVisible&&this.showOverlay(),this.setState({focused:!0},(function(){t.props.onFocus&&t.props.onFocus(e)}))}},{key:"onInputBlur",value:function(e){var t=this;e.persist(),this.setState({focused:!1},(function(){t.props.onBlur&&t.props.onBlur(e)}))}},{key:"onPanelClick",value:function(e){p.OverlayService.emit("overlay-click",{originalEvent:e,target:this.container})}},{key:"onInputKeyDown",value:function(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.state.overlayVisible?this.hideOverlay():this.showOverlay(),e.preventDefault();break;case 13:this.hideOverlay(),e.preventDefault();break;case 27:case 9:this.hideOverlay();break;default:this.search(e)}}},{key:"onFilterInputKeyDown",value:function(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.hideOverlay(),e.preventDefault()}}},{key:"onUpKey",value:function(e){if(this.getVisibleOptions()){var t=this.findPrevOption(this.getSelectedOptionIndex());t&&this.selectItem({originalEvent:e,option:t})}e.preventDefault()}},{key:"onDownKey",value:function(e){if(this.getVisibleOptions())if(!this.state.overlayVisible&&e.altKey)this.showOverlay();else{var t=this.findNextOption(this.getSelectedOptionIndex());t&&this.selectItem({originalEvent:e,option:t})}e.preventDefault()}},{key:"findNextOption",value:function(e){var t=this.getVisibleOptions();if(this.props.optionGroupLabel){var n=-1===e?0:e.group,i=-1===e?-1:e.option,r=this.findNextOptionInList(this.getOptionGroupChildren(t[n]),i);return r||(n+1!==t.length?this.findNextOption({group:n+1,option:-1}):null)}return this.findNextOptionInList(t,e)}},{key:"findNextOptionInList",value:function(e,t){var n=t+1;if(n===e.length)return null;var i=e[n];return this.isOptionDisabled(i)?this.findNextOptionInList(n):i}},{key:"findPrevOption",value:function(e){if(-1===e)return null;var t=this.getVisibleOptions();if(this.props.optionGroupLabel){var n=e.group,i=e.option,r=this.findPrevOptionInList(this.getOptionGroupChildren(t[n]),i);return r||(n>0?this.findPrevOption({group:n-1,option:this.getOptionGroupChildren(t[n-1]).length}):null)}return this.findPrevOptionInList(t,e)}},{key:"findPrevOptionInList",value:function(e,t){var n=t-1;if(n<0)return null;var i=e[n];return this.isOptionDisabled(i)?this.findPrevOption(n):i}},{key:"search",value:function(e){var t=this;this.searchTimeout&&clearTimeout(this.searchTimeout);var n=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=n,this.searchValue=this.previousSearchChar===this.currentSearchChar?this.currentSearchChar:this.searchValue?this.searchValue+n:n,this.searchValue){var i=this.getSelectedOptionIndex(),r=this.props.optionGroupLabel?this.searchOptionInGroup(i):this.searchOption(++i);r&&(this.selectItem({originalEvent:e,option:r}),this.selectedOptionUpdated=!0)}this.searchTimeout=setTimeout((function(){t.searchValue=null}),250)}},{key:"searchOption",value:function(e){var t;if(this.searchValue){var n=this.getVisibleOptions();(t=this.searchOptionInRange(e,n.length))||(t=this.searchOptionInRange(0,e))}return t}},{key:"searchOptionInRange",value:function(e,t){for(var n=this.getVisibleOptions(),i=e;i<t;i++){var r=n[i];if(this.matchesSearchValue(r))return r}return null}},{key:"searchOptionInGroup",value:function(e){for(var t=-1===e?{group:0,option:-1}:e,n=this.getVisibleOptions(),i=t.group;i<n.length;i++)for(var r=this.getOptionGroupChildren(n[i]),o=t.group===i?t.option+1:0;o<r.length;o++)if(this.matchesSearchValue(r[o]))return r[o];for(var l=0;l<=t.group;l++)for(var s=this.getOptionGroupChildren(n[l]),a=0;a<(t.group===l?t.option:s.length);a++)if(this.matchesSearchValue(s[a]))return s[a];return null}},{key:"matchesSearchValue",value:function(e){return this.getOptionLabel(e).toLocaleLowerCase(this.props.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.props.filterLocale))}},{key:"onEditableInputChange",value:function(e){this.props.onChange&&this.props.onChange({originalEvent:e.originalEvent,value:e.target.value,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:e.target.value}})}},{key:"onEditableInputFocus",value:function(e){var t=this;e.persist(),this.setState({focused:!0},(function(){t.hideOverlay(),t.props.onFocus&&t.props.onFocus(e)}))}},{key:"onOptionClick",value:function(e){e.option.disabled||(this.selectItem(e),this.focusInput.focus()),this.hideOverlay()}},{key:"onFilterInputChange",value:function(e){var t=this,n=e.target.value;this.setState({filter:n},(function(){t.props.onFilter&&t.props.onFilter({originalEvent:e,filter:n})}))}},{key:"onFilterClearIconClick",value:function(e){this.resetFilter(e)}},{key:"resetFilter",value:function(e){var t=this;this.setState({filter:""},(function(){t.props.onFilter&&t.props.onFilter({filter:""}),e&&e()}))}},{key:"clear",value:function(e){this.props.onChange&&this.props.onChange({originalEvent:e,value:void 0,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:void 0}}),this.updateEditableLabel()}},{key:"selectItem",value:function(e){if(this.getSelectedOption()!==e.option){this.updateEditableLabel(e.option);var t=this.getOptionValue(e.option);this.props.onChange&&this.props.onChange({originalEvent:e.originalEvent,value:t,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:t}})}}},{key:"getSelectedOption",value:function(){var e=this.getSelectedOptionIndex(),t=this.getVisibleOptions();return-1!==e?this.props.optionGroupLabel?this.getOptionGroupChildren(t[e.group])[e.option]:t[e]:null}},{key:"getSelectedOptionIndex",value:function(){var e=this.getVisibleOptions();if(null!=this.props.value&&e){if(!this.props.optionGroupLabel)return this.findOptionIndexInList(this.props.value,e);for(var t=0;t<e.length;t++){var n=this.findOptionIndexInList(this.props.value,this.getOptionGroupChildren(e[t]));if(-1!==n)return{group:t,option:n}}}return-1}},{key:"findOptionIndexInList",value:function(e,t){for(var i=this.equalityKey(),r=0;r<t.length;r++)if(n.ObjectUtils.equals(e,this.getOptionValue(t[r]),i))return r;return-1}},{key:"isSelected",value:function(e){return n.ObjectUtils.equals(this.props.value,this.getOptionValue(e),this.equalityKey())}},{key:"equalityKey",value:function(){return this.props.optionValue?null:this.props.dataKey}},{key:"showOverlay",value:function(){this.setState({overlayVisible:!0})}},{key:"hideOverlay",value:function(){this.setState({overlayVisible:!1})}},{key:"onOverlayEnter",value:function(e){n.ZIndexUtils.set("overlay",this.overlayRef.current,h.default.autoZIndex,h.default.zIndex.overlay),this.alignOverlay(),e&&e()}},{key:"onOverlayEntered",value:function(e){e&&e(),this.bindDocumentClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.props.onShow&&this.props.onShow()}},{key:"onOverlayExit",value:function(){this.unbindDocumentClickListener(),this.unbindScrollListener(),this.unbindResizeListener()}},{key:"onOverlayExited",value:function(){this.props.filter&&this.props.resetFilterOnHide&&this.resetFilter(),n.ZIndexUtils.clear(this.overlayRef.current),this.props.onHide&&this.props.onHide()}},{key:"alignOverlay",value:function(){n.DomHandler.alignOverlay(this.overlayRef.current,this.input.parentElement,this.props.appendTo||h.default.appendTo)}},{key:"scrollInView",value:function(){var e=n.DomHandler.findSingle(this.overlayRef.current,"li.p-highlight");e&&e.scrollIntoView&&e.scrollIntoView({block:"nearest",inline:"start"})}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){e.state.overlayVisible&&e.isOutsideClicked(t)&&e.hideOverlay()},document.addEventListener("click",this.documentClickListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new n.ConnectedOverlayScrollHandler(this.container,(function(){e.state.overlayVisible&&e.hideOverlay()}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"bindResizeListener",value:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.state.overlayVisible&&!n.DomHandler.isTouchDevice()&&e.hideOverlay()},window.addEventListener("resize",this.resizeListener))}},{key:"unbindResizeListener",value:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)}},{key:"isOutsideClicked",value:function(e){return this.container&&!(this.container.isSameNode(e.target)||this.isClearClicked(e)||this.container.contains(e.target)||this.overlayRef&&this.overlayRef.current.contains(e.target))}},{key:"isClearClicked",value:function(e){return n.DomHandler.hasClass(e.target,"p-dropdown-clear-icon")||n.DomHandler.hasClass(e.target,"p-dropdown-filter-clear-icon")}},{key:"updateEditableLabel",value:function(e){this.input&&(this.input.value=e?this.getOptionLabel(e):this.props.value||"")}},{key:"hasFilter",value:function(){return this.state.filter&&this.state.filter.trim().length>0}},{key:"getOptionLabel",value:function(e){return this.props.optionLabel?n.ObjectUtils.resolveFieldData(e,this.props.optionLabel):e&&void 0!==e.label?e.label:e}},{key:"getOptionValue",value:function(e){return this.props.optionValue?n.ObjectUtils.resolveFieldData(e,this.props.optionValue):e&&void 0!==e.value?e.value:e}},{key:"getOptionRenderKey",value:function(e){return this.props.dataKey?n.ObjectUtils.resolveFieldData(e,this.props.dataKey):this.getOptionLabel(e)}},{key:"isOptionDisabled",value:function(e){return this.props.optionDisabled?n.ObjectUtils.isFunction(this.props.optionDisabled)?this.props.optionDisabled(e):n.ObjectUtils.resolveFieldData(e,this.props.optionDisabled):!(!e||void 0===e.disabled)&&e.disabled}},{key:"getOptionGroupRenderKey",value:function(e){return n.ObjectUtils.resolveFieldData(e,this.props.optionGroupLabel)}},{key:"getOptionGroupLabel",value:function(e){return n.ObjectUtils.resolveFieldData(e,this.props.optionGroupLabel)}},{key:"getOptionGroupChildren",value:function(e){return n.ObjectUtils.resolveFieldData(e,this.props.optionGroupChildren)}},{key:"checkValidity",value:function(){return!!this.inputRef.current&&this.inputRef.current.checkValidity()}},{key:"isLazy",value:function(){return this.props.virtualScrollerOptions&&this.props.virtualScrollerOptions.lazy}},{key:"getVisibleOptions",value:function(){if(this.hasFilter()&&!this.isLazy()){var e=this.state.filter.trim().toLocaleLowerCase(this.props.filterLocale),t=this.props.filterBy?this.props.filterBy.split(","):[this.props.optionLabel||"label"];if(this.props.optionGroupLabel){var n,i=[],r=j(this.props.options);try{for(r.s();!(n=r.n()).done;){var o=n.value,l=s.FilterService.filter(this.getOptionGroupChildren(o),t,e,this.props.filterMatchMode,this.props.filterLocale);l&&l.length&&i.push(V(V({},o),{items:l}))}}catch(e){r.e(e)}finally{r.f()}return i}return s.FilterService.filter(this.props.options,t,e,this.props.filterMatchMode,this.props.filterLocale)}return this.props.options}},{key:"updateInputField",value:function(){if(this.props.editable&&this.input){var e=this.getSelectedOption(),t=e?this.getOptionLabel(e):null;this.input.value=t||this.props.value||""}}},{key:"updateInputRef",value:function(){var e=this.props.inputRef;e&&("function"==typeof e?e(this.inputRef.current):e.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.props.autoFocus&&this.focusInput&&this.focusInput.focus(),this.props.tooltip&&this.renderTooltip(),this.updateInputField(),this.inputRef.current&&(this.inputRef.current.selectedIndex=1)}},{key:"componentWillUnmount",value:function(){this.unbindDocumentClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.tooltip&&(this.tooltip.destroy(),this.tooltip=null),this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),n.ZIndexUtils.clear(this.overlayRef.current)}},{key:"componentDidUpdate",value:function(e){this.state.overlayVisible&&(this.props.filter&&this.alignOverlay(),e.value!==this.props.value&&this.scrollInView()),e.tooltip===this.props.tooltip&&e.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(V({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),!this.state.filter||this.props.options&&0!==this.props.options.length||this.setState({filter:""}),this.updateInputField(),this.inputRef.current&&(this.inputRef.current.selectedIndex=1)}},{key:"renderHiddenSelect",value:function(e){var t=c.default.createElement("option",{value:""},this.props.placeholder),n=e?c.default.createElement("option",{value:e.value},this.getOptionLabel(e)):null;return c.default.createElement("div",{className:"p-hidden-accessible p-dropdown-hidden-select"},c.default.createElement("select",{ref:this.inputRef,required:this.props.required,name:this.props.name,tabIndex:-1,"aria-hidden":"true"},t,n))}},{key:"renderTooltip",value:function(){this.tooltip=a.tip({target:this.container,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"renderKeyboardHelper",value:function(){var e=this;return c.default.createElement("div",{className:"p-hidden-accessible"},c.default.createElement("input",{ref:function(t){return e.focusInput=t},id:this.props.inputId,type:"text",readOnly:!0,"aria-haspopup":"listbox",onFocus:this.onInputFocus,onBlur:this.onInputBlur,onKeyDown:this.onInputKeyDown,disabled:this.props.disabled,tabIndex:this.props.tabIndex,"aria-label":this.props.ariaLabel,"aria-labelledby":this.props.ariaLabelledBy}))}},{key:"renderLabel",value:function(e){var t=this,i=n.ObjectUtils.isNotEmpty(e)?this.getOptionLabel(e):null;if(this.props.editable)return c.default.createElement("input",{ref:function(e){return t.input=e},type:"text",defaultValue:i||this.props.value||"",className:"p-dropdown-label p-inputtext",disabled:this.props.disabled,placeholder:this.props.placeholder,maxLength:this.props.maxLength,onInput:this.onEditableInputChange,onFocus:this.onEditableInputFocus,onBlur:this.onInputBlur,"aria-label":this.props.ariaLabel,"aria-labelledby":this.props.ariaLabelledBy,"aria-haspopup":"listbox"});var r=n.classNames("p-dropdown-label p-inputtext",{"p-placeholder":null===i&&this.props.placeholder,"p-dropdown-label-empty":null===i&&!this.props.placeholder}),o=this.props.valueTemplate?n.ObjectUtils.getJSXElement(this.props.valueTemplate,e,this.props):i||this.props.placeholder||"empty";return c.default.createElement("span",{ref:function(e){return t.input=e},className:r},o)}},{key:"renderClearIcon",value:function(){return null!=this.props.value&&this.props.showClear&&!this.props.disabled?c.default.createElement("i",{className:"p-dropdown-clear-icon pi pi-times",onClick:this.clear}):null}},{key:"renderDropdownIcon",value:function(){var e=this,t=n.classNames("p-dropdown-trigger-icon p-clickable",this.props.dropdownIcon);return c.default.createElement("div",{ref:function(t){return e.trigger=t},className:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":this.state.overlayVisible},c.default.createElement("span",{className:t}))}},{key:"render",value:function(){var e=this,t=n.classNames("p-dropdown p-component p-inputwrapper",this.props.className,{"p-disabled":this.props.disabled,"p-focus":this.state.focused,"p-dropdown-clearable":this.props.showClear&&!this.props.disabled,"p-inputwrapper-filled":this.props.value,"p-inputwrapper-focus":this.state.focused||this.state.overlayVisible}),i=this.getVisibleOptions(),r=this.getSelectedOption(),o=this.props.appendTo||h.default.appendTo,l=this.renderHiddenSelect(r),s=this.renderKeyboardHelper(),a=this.renderLabel(r),p=this.renderDropdownIcon(),u=this.renderClearIcon();return c.default.createElement("div",{id:this.props.id,ref:function(t){return e.container=t},className:t,style:this.props.style,onClick:this.onClick,onMouseDown:this.props.onMouseDown,onContextMenu:this.props.onContextMenu},s,l,a,u,p,c.default.createElement(x,d({ref:this.overlayRef,visibleOptions:i},this.props,{appendTo:o,onClick:this.onPanelClick,onOptionClick:this.onOptionClick,filterValue:this.state.filter,hasFilter:this.hasFilter,onFilterClearIconClick:this.onFilterClearIconClick,onFilterInputKeyDown:this.onFilterInputKeyDown,onFilterInputChange:this.onFilterInputChange,getOptionLabel:this.getOptionLabel,getOptionRenderKey:this.getOptionRenderKey,isOptionDisabled:this.isOptionDisabled,getOptionGroupChildren:this.getOptionGroupChildren,getOptionGroupLabel:this.getOptionGroupLabel,getOptionGroupRenderKey:this.getOptionGroupRenderKey,isSelected:this.isSelected,getSelectedOptionIndex:this.getSelectedOptionIndex,in:this.state.overlayVisible,onEnter:this.onOverlayEnter,onEntered:this.onOverlayEntered,onExit:this.onOverlayExit,onExited:this.onOverlayExited})))}}]),l}(t.Component);return I(K,"defaultProps",{id:null,inputRef:null,name:null,value:null,options:null,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,optionGroupTemplate:null,valueTemplate:null,itemTemplate:null,style:null,className:null,virtualScrollerOptions:null,scrollHeight:"200px",filter:!1,filterBy:null,filterMatchMode:"contains",filterPlaceholder:null,filterLocale:void 0,emptyMessage:null,emptyFilterMessage:null,editable:!1,placeholder:null,required:!1,disabled:!1,appendTo:null,tabIndex:null,autoFocus:!1,filterInputAutoFocus:!0,resetFilterOnHide:!1,showFilterClear:!1,panelClassName:null,panelStyle:null,dataKey:null,inputId:null,showClear:!1,maxLength:null,tooltip:null,tooltipOptions:null,ariaLabel:null,ariaLabelledBy:null,transitionOptions:null,dropdownIcon:"pi pi-chevron-down",showOnFocus:!1,onChange:null,onFocus:null,onBlur:null,onMouseDown:null,onContextMenu:null,onShow:null,onHide:null,onFilter:null}),e.Dropdown=K,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils,primereact.ripple,primereact.csstransition,primereact.portal,primereact.virtualscroller,primereact.api,primereact.tooltip,primereact.overlayservice);
|
package/galleria/galleria.cjs.js
CHANGED
|
@@ -413,6 +413,217 @@ function _toConsumableArray(arr) {
|
|
|
413
413
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
+
var ObjectUtils = /*#__PURE__*/function () {
|
|
417
|
+
function ObjectUtils() {
|
|
418
|
+
_classCallCheck(this, ObjectUtils);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
_createClass(ObjectUtils, null, [{
|
|
422
|
+
key: "equals",
|
|
423
|
+
value: function equals(obj1, obj2, field) {
|
|
424
|
+
if (field && obj1 && _typeof(obj1) === 'object' && obj2 && _typeof(obj2) === 'object') return this.resolveFieldData(obj1, field) === this.resolveFieldData(obj2, field);else return this.deepEquals(obj1, obj2);
|
|
425
|
+
}
|
|
426
|
+
}, {
|
|
427
|
+
key: "deepEquals",
|
|
428
|
+
value: function deepEquals(a, b) {
|
|
429
|
+
if (a === b) return true;
|
|
430
|
+
|
|
431
|
+
if (a && b && _typeof(a) == 'object' && _typeof(b) == 'object') {
|
|
432
|
+
var arrA = Array.isArray(a),
|
|
433
|
+
arrB = Array.isArray(b),
|
|
434
|
+
i,
|
|
435
|
+
length,
|
|
436
|
+
key;
|
|
437
|
+
|
|
438
|
+
if (arrA && arrB) {
|
|
439
|
+
length = a.length;
|
|
440
|
+
if (length !== b.length) return false;
|
|
441
|
+
|
|
442
|
+
for (i = length; i-- !== 0;) {
|
|
443
|
+
if (!this.deepEquals(a[i], b[i])) return false;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
return true;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
if (arrA !== arrB) return false;
|
|
450
|
+
var dateA = a instanceof Date,
|
|
451
|
+
dateB = b instanceof Date;
|
|
452
|
+
if (dateA !== dateB) return false;
|
|
453
|
+
if (dateA && dateB) return a.getTime() === b.getTime();
|
|
454
|
+
var regexpA = a instanceof RegExp,
|
|
455
|
+
regexpB = b instanceof RegExp;
|
|
456
|
+
if (regexpA !== regexpB) return false;
|
|
457
|
+
if (regexpA && regexpB) return a.toString() === b.toString();
|
|
458
|
+
var keys = Object.keys(a);
|
|
459
|
+
length = keys.length;
|
|
460
|
+
if (length !== Object.keys(b).length) return false;
|
|
461
|
+
|
|
462
|
+
for (i = length; i-- !== 0;) {
|
|
463
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
for (i = length; i-- !== 0;) {
|
|
467
|
+
key = keys[i];
|
|
468
|
+
if (!this.deepEquals(a[key], b[key])) return false;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
/*eslint no-self-compare: "off"*/
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
return a !== a && b !== b;
|
|
477
|
+
}
|
|
478
|
+
}, {
|
|
479
|
+
key: "resolveFieldData",
|
|
480
|
+
value: function resolveFieldData(data, field) {
|
|
481
|
+
if (data && Object.keys(data).length && field) {
|
|
482
|
+
if (this.isFunction(field)) {
|
|
483
|
+
return field(data);
|
|
484
|
+
} else if (field.indexOf('.') === -1) {
|
|
485
|
+
return data[field];
|
|
486
|
+
} else {
|
|
487
|
+
var fields = field.split('.');
|
|
488
|
+
var value = data;
|
|
489
|
+
|
|
490
|
+
for (var i = 0, len = fields.length; i < len; ++i) {
|
|
491
|
+
if (value == null) {
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
value = value[fields[i]];
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
return value;
|
|
499
|
+
}
|
|
500
|
+
} else {
|
|
501
|
+
return null;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}, {
|
|
505
|
+
key: "isFunction",
|
|
506
|
+
value: function isFunction(obj) {
|
|
507
|
+
return !!(obj && obj.constructor && obj.call && obj.apply);
|
|
508
|
+
}
|
|
509
|
+
}, {
|
|
510
|
+
key: "findDiffKeys",
|
|
511
|
+
value: function findDiffKeys(obj1, obj2) {
|
|
512
|
+
if (!obj1 || !obj2) {
|
|
513
|
+
return {};
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
return Object.keys(obj1).filter(function (key) {
|
|
517
|
+
return !obj2.hasOwnProperty(key);
|
|
518
|
+
}).reduce(function (result, current) {
|
|
519
|
+
result[current] = obj1[current];
|
|
520
|
+
return result;
|
|
521
|
+
}, {});
|
|
522
|
+
}
|
|
523
|
+
}, {
|
|
524
|
+
key: "reorderArray",
|
|
525
|
+
value: function reorderArray(value, from, to) {
|
|
526
|
+
var target;
|
|
527
|
+
|
|
528
|
+
if (value && from !== to) {
|
|
529
|
+
if (to >= value.length) {
|
|
530
|
+
target = to - value.length;
|
|
531
|
+
|
|
532
|
+
while (target-- + 1) {
|
|
533
|
+
value.push(undefined);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
value.splice(to, 0, value.splice(from, 1)[0]);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}, {
|
|
541
|
+
key: "findIndexInList",
|
|
542
|
+
value: function findIndexInList(value, list, dataKey) {
|
|
543
|
+
var _this = this;
|
|
544
|
+
|
|
545
|
+
if (list) {
|
|
546
|
+
return dataKey ? list.findIndex(function (item) {
|
|
547
|
+
return _this.equals(item, value, dataKey);
|
|
548
|
+
}) : list.findIndex(function (item) {
|
|
549
|
+
return item === value;
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return -1;
|
|
554
|
+
}
|
|
555
|
+
}, {
|
|
556
|
+
key: "getJSXElement",
|
|
557
|
+
value: function getJSXElement(obj) {
|
|
558
|
+
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
559
|
+
params[_key - 1] = arguments[_key];
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
return this.isFunction(obj) ? obj.apply(void 0, params) : obj;
|
|
563
|
+
}
|
|
564
|
+
}, {
|
|
565
|
+
key: "getPropValue",
|
|
566
|
+
value: function getPropValue(obj) {
|
|
567
|
+
for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
568
|
+
params[_key2 - 1] = arguments[_key2];
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
return this.isFunction(obj) ? obj.apply(void 0, params) : obj;
|
|
572
|
+
}
|
|
573
|
+
}, {
|
|
574
|
+
key: "getRefElement",
|
|
575
|
+
value: function getRefElement(ref) {
|
|
576
|
+
if (ref) {
|
|
577
|
+
return _typeof(ref) === 'object' && ref.hasOwnProperty('current') ? ref.current : ref;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
return null;
|
|
581
|
+
}
|
|
582
|
+
}, {
|
|
583
|
+
key: "removeAccents",
|
|
584
|
+
value: function removeAccents(str) {
|
|
585
|
+
if (str && str.search(/[\xC0-\xFF]/g) > -1) {
|
|
586
|
+
str = str.replace(/[\xC0-\xC5]/g, "A").replace(/[\xC6]/g, "AE").replace(/[\xC7]/g, "C").replace(/[\xC8-\xCB]/g, "E").replace(/[\xCC-\xCF]/g, "I").replace(/[\xD0]/g, "D").replace(/[\xD1]/g, "N").replace(/[\xD2-\xD6\xD8]/g, "O").replace(/[\xD9-\xDC]/g, "U").replace(/[\xDD]/g, "Y").replace(/[\xDE]/g, "P").replace(/[\xE0-\xE5]/g, "a").replace(/[\xE6]/g, "ae").replace(/[\xE7]/g, "c").replace(/[\xE8-\xEB]/g, "e").replace(/[\xEC-\xEF]/g, "i").replace(/[\xF1]/g, "n").replace(/[\xF2-\xF6\xF8]/g, "o").replace(/[\xF9-\xFC]/g, "u").replace(/[\xFE]/g, "p").replace(/[\xFD\xFF]/g, "y");
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
return str;
|
|
590
|
+
}
|
|
591
|
+
}, {
|
|
592
|
+
key: "isEmpty",
|
|
593
|
+
value: function isEmpty(value) {
|
|
594
|
+
return value === null || value === undefined || value === '' || Array.isArray(value) && value.length === 0 || !(value instanceof Date) && _typeof(value) === 'object' && Object.keys(value).length === 0;
|
|
595
|
+
}
|
|
596
|
+
}, {
|
|
597
|
+
key: "isNotEmpty",
|
|
598
|
+
value: function isNotEmpty(value) {
|
|
599
|
+
return !this.isEmpty(value);
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Compare value1 and value2 ascending by default (1) or pass in order as -1 for descending.
|
|
603
|
+
*
|
|
604
|
+
* @param {any} value1 the first value
|
|
605
|
+
* @param {any} value2 the second value
|
|
606
|
+
* @param {number | undefined} order by default ascending (1) set to descending (-1)
|
|
607
|
+
* @param {string | undefined} locale the locale to use (default to browser locale if null)
|
|
608
|
+
* @returns either 0, 1 or -1 for comparing the two values
|
|
609
|
+
*/
|
|
610
|
+
|
|
611
|
+
}, {
|
|
612
|
+
key: "sort",
|
|
613
|
+
value: function sort(value1, value2) {
|
|
614
|
+
var order = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
615
|
+
var locale = arguments.length > 3 ? arguments[3] : undefined;
|
|
616
|
+
var result = null;
|
|
617
|
+
if (value1 == null && value2 != null) result = -1;else if (value1 != null && value2 == null) result = 1;else if (value1 == null && value2 == null) result = 0;else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2, locale, {
|
|
618
|
+
numeric: true
|
|
619
|
+
});else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
|
620
|
+
return order * result;
|
|
621
|
+
}
|
|
622
|
+
}]);
|
|
623
|
+
|
|
624
|
+
return ObjectUtils;
|
|
625
|
+
}();
|
|
626
|
+
|
|
416
627
|
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
417
628
|
|
|
418
629
|
function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -687,11 +898,7 @@ var GalleriaThumbnails = /*#__PURE__*/function (_Component2) {
|
|
|
687
898
|
this.responsiveOptions.sort(function (data1, data2) {
|
|
688
899
|
var value1 = data1.breakpoint;
|
|
689
900
|
var value2 = data2.breakpoint;
|
|
690
|
-
|
|
691
|
-
if (value1 == null && value2 != null) result = -1;else if (value1 != null && value2 == null) result = 1;else if (value1 == null && value2 == null) result = 0;else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2, undefined, {
|
|
692
|
-
numeric: true
|
|
693
|
-
});else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
|
694
|
-
return -1 * result;
|
|
901
|
+
return ObjectUtils.sort(value1, value2, -1, PrimeReact__default["default"].locale);
|
|
695
902
|
});
|
|
696
903
|
|
|
697
904
|
for (var i = 0; i < this.responsiveOptions.length; i++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils"),i=require("primereact/ripple"),n=require("primereact/api"),s=require("primereact/csstransition"),r=require("primereact/portal");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=a(e),l=a(n);function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,i){return t&&c(e.prototype,t),i&&c(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}function v(e){return v="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},v(e)}function f(e,t){if(t&&("object"===v(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function I(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function y(){return y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},y.apply(this,arguments)}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var w=function(n){m(l,e.Component);var s,r,a=(s=l,r=g(),function(){var e,t=b(s);if(r){var i=b(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return f(this,e)});function l(e){var t;return p(this,l),(t=a.call(this,e)).navForward=t.navForward.bind(h(t)),t.navBackward=t.navBackward.bind(h(t)),t.next=t.next.bind(h(t)),t.prev=t.prev.bind(h(t)),t}return u(l,[{key:"step",value:function(e){this.itemsContainer&&(this.itemsContainer.style.transform=this.isVertical()?"translate3d(0, ".concat(100*e,"%, 0)"):"translate3d(".concat(100*e,"%, 0, 0)"),this.itemsContainer.style.transition="transform 500ms ease 0s")}},{key:"next",value:function(){this.props.onActiveItemChange({index:this.props.circular&&this.props.value.length-1===this.props.activeItemIndex?0:this.props.activeItemIndex+1})}},{key:"prev",value:function(){this.props.onActiveItemChange({index:this.props.circular&&0===this.props.activeItemIndex?this.props.value.length-1:0!==this.props.activeItemIndex?this.props.activeItemIndex-1:0})}},{key:"stopSlideShow",value:function(){this.props.slideShowActive&&this.props.stopSlideShow&&this.props.stopSlideShow()}},{key:"navBackward",value:function(e){this.stopSlideShow(),this.prev(),e&&e.cancelable&&e.preventDefault()}},{key:"navForward",value:function(e){this.stopSlideShow(),this.next(),e&&e.cancelable&&e.preventDefault()}},{key:"onIndicatorClick",value:function(e){this.stopSlideShow(),this.props.onActiveItemChange({index:e})}},{key:"onIndicatorMouseEnter",value:function(e){this.props.changeItemOnIndicatorHover&&(this.stopSlideShow(),this.props.onActiveItemChange({index:e}))}},{key:"onIndicatorKeyDown",value:function(e,t){13===e.which&&(this.stopSlideShow(),this.props.onActiveItemChange({index:t}))}},{key:"componentDidMount",value:function(){this.props.autoPlay&&this.props.startSlideShow()}},{key:"renderBackwardNavigator",value:function(){if(this.props.showItemNavigators){var e=!this.props.circular&&0===this.props.activeItemIndex,n=t.classNames("p-galleria-item-prev p-galleria-item-nav p-link",{"p-disabled":e});return o.default.createElement("button",{type:"button",className:n,onClick:this.navBackward,disabled:e},o.default.createElement("span",{className:"p-galleria-item-prev-icon pi pi-chevron-left"}),o.default.createElement(i.Ripple,null))}return null}},{key:"renderForwardNavigator",value:function(){if(this.props.showItemNavigators){var e=!this.props.circular&&this.props.activeItemIndex===this.props.value.length-1,n=t.classNames("p-galleria-item-next p-galleria-item-nav p-link",{"p-disabled":e});return o.default.createElement("button",{type:"button",className:n,onClick:this.navForward,disabled:e},o.default.createElement("span",{className:"p-galleria-item-next-icon pi pi-chevron-right"}),o.default.createElement(i.Ripple,null))}return null}},{key:"renderCaption",value:function(){if(this.props.caption){var e=this.props.caption(this.props.value[this.props.activeItemIndex]);return o.default.createElement("div",{className:"p-galleria-caption"},e)}return null}},{key:"renderIndicator",value:function(e){var n=this,s=this.props.indicator&&this.props.indicator(e),r=t.classNames("p-galleria-indicator",{"p-highlight":this.props.activeItemIndex===e});return s||(s=o.default.createElement("button",{type:"button",tabIndex:-1,className:"p-link"},o.default.createElement(i.Ripple,null))),o.default.createElement("li",{className:r,key:"p-galleria-indicator-"+e,tabIndex:0,onClick:function(){return n.onIndicatorClick(e)},onMouseEnter:function(){return n.onIndicatorMouseEnter(e)},onKeyDown:function(t){return n.onIndicatorKeyDown(t,e)}},s)}},{key:"renderIndicators",value:function(){if(this.props.showIndicators){for(var e=t.classNames("p-galleria-indicators p-reset",this.props.indicatorsContentClassName),i=[],n=0;n<this.props.value.length;n++)i.push(this.renderIndicator(n));return o.default.createElement("ul",{className:e},i)}return null}},{key:"render",value:function(){var e=this,t=this.props.itemTemplate&&this.props.itemTemplate(this.props.value[this.props.activeItemIndex]),i=this.renderBackwardNavigator(),n=this.renderForwardNavigator(),s=this.renderCaption(),r=this.renderIndicators();return o.default.createElement("div",{ref:function(t){return e.props.forwardRef(t)},className:"p-galleria-item-wrapper"},o.default.createElement("div",{className:"p-galleria-item-container"},i,o.default.createElement("div",{className:"p-galleria-item"},t),n,s),r)}}]),l}(),S=o.default.forwardRef((function(e,t){return o.default.createElement(w,y({forwardRef:t},e))}));function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function x(e){if(Array.isArray(e))return k(e)}function E(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function C(e,t){if(e){if("string"==typeof e)return k(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?k(e,t):void 0}}function N(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function O(e){var t=V();return function(){var i,n=b(e);if(t){var s=b(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return f(this,i)}}function V(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var P=function(i){m(s,e.Component);var n=O(s);function s(e){var t;return p(this,s),(t=n.call(this,e)).onItemClick=t.onItemClick.bind(h(t)),t.onItemKeyDown=t.onItemKeyDown.bind(h(t)),t}return u(s,[{key:"onItemClick",value:function(e){this.props.onItemClick({originalEvent:e,index:this.props.index})}},{key:"onItemKeyDown",value:function(e){13===e.which&&this.props.onItemClick({originalEvent:e,index:this.props.index})}},{key:"render",value:function(){var e=this.props.template&&this.props.template(this.props.item),i=t.classNames(this.props.className,"p-galleria-thumbnail-item",{"p-galleria-thumbnail-item-current":this.props.current,"p-galleria-thumbnail-item-active":this.props.active,"p-galleria-thumbnail-item-start":this.props.start,"p-galleria-thumbnail-item-end":this.props.end});return o.default.createElement("div",{className:i},o.default.createElement("div",{className:"p-galleria-thumbnail-item-content",tabIndex:this.props.active?0:null,onClick:this.onItemClick,onKeyDown:this.onItemKeyDown},e))}}]),s}();I(P,"defaultProps",{index:null,template:null,item:null,current:!1,active:!1,start:!1,end:!1,className:null,onItemClick:null});var T=function(n){m(r,e.Component);var s=O(r);function r(e){var i;return p(this,r),(i=s.call(this,e)).state={numVisible:e.numVisible,totalShiftedItems:0,page:0},i.navForward=i.navForward.bind(h(i)),i.navBackward=i.navBackward.bind(h(i)),i.onTransitionEnd=i.onTransitionEnd.bind(h(i)),i.onTouchStart=i.onTouchStart.bind(h(i)),i.onTouchMove=i.onTouchMove.bind(h(i)),i.onTouchEnd=i.onTouchEnd.bind(h(i)),i.onItemClick=i.onItemClick.bind(h(i)),i.attributeSelector=t.UniqueComponentId(),i}return u(r,[{key:"step",value:function(e){var i=this.state.totalShiftedItems+e;e<0&&-1*i+this.state.numVisible>this.props.value.length-1?i=this.state.numVisible-this.props.value.length:e>0&&i>0&&(i=0),this.props.circular&&(e<0&&this.props.value.length-1===this.props.activeItemIndex?i=0:e>0&&0===this.props.activeItemIndex&&(i=this.state.numVisible-this.props.value.length)),this.itemsContainer&&(t.DomHandler.removeClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transform=this.props.isVertical?"translate3d(0, ".concat(i*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(i*(100/this.state.numVisible),"%, 0, 0)"),this.itemsContainer.style.transition="transform 500ms ease 0s"),this.setState({totalShiftedItems:i})}},{key:"stopSlideShow",value:function(){this.props.slideShowActive&&this.props.stopSlideShow&&this.props.stopSlideShow()}},{key:"getMedianItemIndex",value:function(){var e=Math.floor(this.state.numVisible/2);return this.state.numVisible%2?e:e-1}},{key:"navBackward",value:function(e){this.stopSlideShow();var t=0!==this.props.activeItemIndex?this.props.activeItemIndex-1:0;this.state.numVisible-(t+this.state.totalShiftedItems)-1>this.getMedianItemIndex()&&(-1*this.state.totalShiftedItems!=0||this.props.circular)&&this.step(1),this.props.onActiveItemChange({index:this.props.circular&&0===this.props.activeItemIndex?this.props.value.length-1:t}),e.cancelable&&e.preventDefault()}},{key:"navForward",value:function(e){this.stopSlideShow();var t=this.props.activeItemIndex+1;t+this.state.totalShiftedItems>this.getMedianItemIndex()&&(-1*this.state.totalShiftedItems<this.getTotalPageNumber()-1||this.props.circular)&&this.step(-1),this.props.onActiveItemChange({index:this.props.circular&&this.props.value.length-1===this.props.activeItemIndex?0:t}),e.cancelable&&e.preventDefault()}},{key:"onItemClick",value:function(e){this.stopSlideShow();var t=e.index;if(t!==this.props.activeItemIndex){var i=t+this.state.totalShiftedItems,n=0;t<this.props.activeItemIndex?(n=this.state.numVisible-i-1-this.getMedianItemIndex())>0&&-1*this.state.totalShiftedItems!=0&&this.step(n):(n=this.getMedianItemIndex()-i)<0&&-1*this.state.totalShiftedItems<this.getTotalPageNumber()-1&&this.step(n),this.props.onActiveItemChange({index:t})}}},{key:"onTransitionEnd",value:function(e){this.itemsContainer&&"transform"===e.propertyName&&(t.DomHandler.addClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="")}},{key:"onTouchStart",value:function(e){var t=e.changedTouches[0];this.startPos={x:t.pageX,y:t.pageY}}},{key:"onTouchMove",value:function(e){e.cancelable&&e.preventDefault()}},{key:"onTouchEnd",value:function(e){var t=e.changedTouches[0];this.changePageOnTouch(e,this.props.isVertical?t.pageY-this.startPos.y:t.pageX-this.startPos.x)}},{key:"changePageOnTouch",value:function(e,t){t<0?this.navForward(e):this.navBackward(e)}},{key:"getTotalPageNumber",value:function(){return this.props.value.length>this.state.numVisible?this.props.value.length-this.state.numVisible+1:0}},{key:"createStyle",value:function(){this.thumbnailsStyle||(this.thumbnailsStyle=t.DomHandler.createInlineStyle(l.default.nonce));var e,i="\n .p-galleria-thumbnail-items[".concat(this.attributeSelector,"] .p-galleria-thumbnail-item {\n flex: 1 0 ").concat(100/this.state.numVisible,"%\n }\n ");if(this.props.responsiveOptions){this.responsiveOptions=x(e=this.props.responsiveOptions)||E(e)||C(e)||N(),this.responsiveOptions.sort((function(e,t){var i=e.breakpoint,n=t.breakpoint;return-1*(null==i&&null!=n?-1:null!=i&&null==n?1:null==i&&null==n?0:"string"==typeof i&&"string"==typeof n?i.localeCompare(n,void 0,{numeric:!0}):i<n?-1:i>n?1:0)}));for(var n=0;n<this.responsiveOptions.length;n++){var s=this.responsiveOptions[n];i+="\n @media screen and (max-width: ".concat(s.breakpoint,") {\n .p-galleria-thumbnail-items[").concat(this.attributeSelector,"] .p-galleria-thumbnail-item {\n flex: 1 0 ").concat(100/s.numVisible,"%\n }\n }\n ")}}this.thumbnailsStyle.innerHTML=i}},{key:"calculatePosition",value:function(){if(this.itemsContainer&&this.responsiveOptions){for(var e=window.innerWidth,t={numVisible:this.props.numVisible},i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];parseInt(n.breakpoint,10)>=e&&(t=n)}this.state.numVisible!==t.numVisible&&this.setState({numVisible:t.numVisible})}}},{key:"bindDocumentListeners",value:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(){e.calculatePosition()},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentListeners",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"componentDidMount",value:function(){this.itemsContainer&&this.itemsContainer.setAttribute(this.attributeSelector,""),this.createStyle(),this.calculatePosition(),this.props.responsiveOptions&&this.bindDocumentListeners()}},{key:"componentDidUpdate",value:function(e,i){var n=this.state.totalShiftedItems;i.numVisible===this.state.numVisible&&e.activeItemIndex===this.props.activeItemIndex||((n=this.props.activeItemIndex<=this.getMedianItemIndex()?0:this.props.value.length-this.state.numVisible+this.getMedianItemIndex()<this.props.activeItemIndex?this.state.numVisible-this.props.value.length:this.props.value.length-this.state.numVisible<this.props.activeItemIndex&&this.state.numVisible%2==0?-1*this.props.activeItemIndex+this.getMedianItemIndex()+1:-1*this.props.activeItemIndex+this.getMedianItemIndex())!==this.state.totalShiftedItems&&this.setState({totalShiftedItems:n}),this.itemsContainer.style.transform=this.props.isVertical?"translate3d(0, ".concat(n*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(n*(100/this.state.numVisible),"%, 0, 0)"),e.activeItemIndex!==this.props.activeItemIndex&&(t.DomHandler.removeClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="transform 500ms ease 0s"))}},{key:"componentWillUnmount",value:function(){this.props.responsiveOptions&&this.unbindDocumentListeners()}},{key:"renderItems",value:function(){var e=this;return this.props.value.map((function(t,i){var n=-1*e.state.totalShiftedItems,s=n+e.state.numVisible-1;return o.default.createElement(P,{key:i,index:i,template:e.props.itemTemplate,item:t,active:n<=i&&s>=i,start:n===i,end:s===i,onItemClick:e.onItemClick,current:e.props.activeItemIndex===i})}))}},{key:"renderBackwardNavigator",value:function(){if(this.props.showThumbnailNavigators){var e=!this.props.circular&&0===this.props.activeItemIndex||this.props.value.length<=this.state.numVisible,n=t.classNames("p-galleria-thumbnail-prev p-link",{"p-disabled":e}),s=t.classNames("p-galleria-thumbnail-prev-icon pi",{"pi-chevron-left":!this.props.isVertical,"pi-chevron-up":this.props.isVertical});return o.default.createElement("button",{className:n,onClick:this.navBackward,disabled:e},o.default.createElement("span",{className:s}),o.default.createElement(i.Ripple,null))}return null}},{key:"renderForwardNavigator",value:function(){if(this.props.showThumbnailNavigators){var e=!this.props.circular&&this.props.activeItemIndex===this.props.value.length-1||this.props.value.length<=this.state.numVisible,n=t.classNames("p-galleria-thumbnail-next p-link",{"p-disabled":e}),s=t.classNames("p-galleria-thumbnail-next-icon pi",{"pi-chevron-right":!this.props.isVertical,"pi-chevron-down":this.props.isVertical});return o.default.createElement("button",{className:n,onClick:this.navForward,disabled:e},o.default.createElement("span",{className:s}),o.default.createElement(i.Ripple,null))}return null}},{key:"renderContent",value:function(){var e=this,t=this.renderItems(),i=this.props.isVertical?this.props.contentHeight:"",n=this.renderBackwardNavigator(),s=this.renderForwardNavigator();return o.default.createElement("div",{className:"p-galleria-thumbnail-container"},n,o.default.createElement("div",{className:"p-galleria-thumbnail-items-container",style:{height:i}},o.default.createElement("div",{ref:function(t){return e.itemsContainer=t},className:"p-galleria-thumbnail-items",onTransitionEnd:this.onTransitionEnd,onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd},t)),s)}},{key:"render",value:function(){var e=this.renderContent();return o.default.createElement("div",{className:"p-galleria-thumbnail-wrapper"},e)}}]),r}();function A(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function R(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?A(Object(i),!0).forEach((function(t){I(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):A(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function D(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var j=function(n){m(v,e.Component);var a,c,d=(a=v,c=D(),function(){var e,t=b(a);if(c){var i=b(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return f(this,e)});function v(e){var t;return p(this,v),(t=d.call(this,e)).state={visible:!1,numVisible:e.numVisible,slideShowActive:!1},t.props.onItemChange||(t.state=R(R({},t.state),{},{activeIndex:e.activeIndex})),t.onActiveItemChange=t.onActiveItemChange.bind(h(t)),t.show=t.show.bind(h(t)),t.hide=t.hide.bind(h(t)),t.startSlideShow=t.startSlideShow.bind(h(t)),t.stopSlideShow=t.stopSlideShow.bind(h(t)),t.onEnter=t.onEnter.bind(h(t)),t.onEntering=t.onEntering.bind(h(t)),t.onEntered=t.onEntered.bind(h(t)),t.onExit=t.onExit.bind(h(t)),t.onExited=t.onExited.bind(h(t)),t.galleriaRef=o.default.createRef(),t}return u(v,[{key:"activeItemIndex",get:function(){return this.props.onItemChange?this.props.activeIndex:this.state.activeIndex}},{key:"onActiveItemChange",value:function(e){this.props.onItemChange?this.props.onItemChange(e):this.setState({activeIndex:e.index})}},{key:"show",value:function(){this.setState({visible:!0})}},{key:"hide",value:function(){this.setState({visible:!1})}},{key:"onEnter",value:function(){t.DomHandler.addClass(document.body,"p-overflow-hidden")}},{key:"onEntering",value:function(){t.ZIndexUtils.set("modal",this.mask,l.default.autoZIndex,this.props.baseZIndex||l.default.zIndex.modal),t.DomHandler.addMultipleClasses(this.mask,"p-component-overlay p-component-overlay-enter")}},{key:"onEntered",value:function(){this.props.onShow&&this.props.onShow()}},{key:"onExit",value:function(){t.DomHandler.removeClass(document.body,"p-overflow-hidden"),t.DomHandler.addClass(this.mask,"p-component-overlay-leave")}},{key:"onExited",value:function(){t.ZIndexUtils.clear(this.mask),this.props.onHide&&this.props.onHide()}},{key:"isAutoPlayActive",value:function(){return this.state.slideShowActive}},{key:"startSlideShow",value:function(){var e=this;this.interval=setInterval((function(){e.onActiveItemChange({index:e.props.circular&&e.props.value.length-1===e.activeItemIndex?0:e.activeItemIndex+1})}),this.props.transitionInterval),this.setState({slideShowActive:!0})}},{key:"stopSlideShow",value:function(){this.interval&&clearInterval(this.interval),this.setState({slideShowActive:!1})}},{key:"getPositionClassName",value:function(e,t){var i=["top","left","bottom","right"].find((function(e){return e===t}));return i?"".concat(e,"-").concat(i):""}},{key:"isVertical",value:function(){return"left"===this.props.thumbnailsPosition||"right"===this.props.thumbnailsPosition}},{key:"componentDidUpdate",value:function(e,t){e.value!==this.props.value&&this.props.value&&this.props.value.length<this.state.numVisible&&this.setState({numVisible:this.props.value.length}),e.numVisible!==this.props.numVisible&&this.setState({numVisible:this.props.numVisible})}},{key:"componentWillUnmount",value:function(){this.state.slideShowActive&&this.stopSlideShow(),t.ZIndexUtils.clear(this.mask)}},{key:"renderHeader",value:function(){return this.props.header?o.default.createElement("div",{className:"p-galleria-header"},this.props.header):null}},{key:"renderFooter",value:function(){return this.props.footer?o.default.createElement("div",{className:"p-galleria-footer"},this.props.footer):null}},{key:"renderElement",value:function(){var e=this,n=this.isVertical(),s=this.props.showThumbnails&&this.getPositionClassName("p-galleria-thumbnails",this.props.thumbnailsPosition),r=this.props.showIndicators&&this.getPositionClassName("p-galleria-indicators",this.props.indicatorsPosition),a=t.classNames("p-galleria p-component",this.props.className,{"p-galleria-fullscreen":this.props.fullScreen,"p-galleria-indicator-onitem":this.props.showIndicatorsOnItem,"p-galleria-item-nav-onhover":this.props.showItemNavigatorsOnHover&&!this.props.fullScreen},s,r),l=this.props.fullScreen&&o.default.createElement("button",{type:"button",className:"p-galleria-close p-link",onClick:this.hide},o.default.createElement("span",{className:"p-galleria-close-icon pi pi-times"}),o.default.createElement(i.Ripple,null)),p=this.renderHeader(),c=this.renderFooter();return o.default.createElement("div",{ref:this.galleriaRef,id:this.props.id,className:a,style:this.props.style},l,p,o.default.createElement("div",{className:"p-galleria-content"},o.default.createElement(S,{ref:function(t){return e.previewContent=t},value:this.props.value,activeItemIndex:this.activeItemIndex,onActiveItemChange:this.onActiveItemChange,itemTemplate:this.props.item,circular:this.props.circular,caption:this.props.caption,showIndicators:this.props.showIndicators,changeItemOnIndicatorHover:this.props.changeItemOnIndicatorHover,indicator:this.props.indicator,showItemNavigators:this.props.showItemNavigators,autoPlay:this.props.autoPlay,slideShowActive:this.state.slideShowActive,startSlideShow:this.startSlideShow,stopSlideShow:this.stopSlideShow}),this.props.showThumbnails&&o.default.createElement(T,{value:this.props.value,activeItemIndex:this.activeItemIndex,onActiveItemChange:this.onActiveItemChange,itemTemplate:this.props.thumbnail,numVisible:this.state.numVisible,responsiveOptions:this.props.responsiveOptions,circular:this.props.circular,isVertical:n,contentHeight:this.props.verticalThumbnailViewPortHeight,showThumbnailNavigators:this.props.showThumbnailNavigators,autoPlay:this.props.autoPlay,slideShowActive:this.state.slideShowActive,stopSlideShow:this.stopSlideShow})),c)}},{key:"renderGalleria",value:function(){var e=this,i=this.renderElement();if(this.props.fullScreen){var n=t.classNames("p-galleria-mask",{"p-galleria-visible":this.state.visible});return o.default.createElement(r.Portal,{element:o.default.createElement("div",{ref:function(t){return e.mask=t},className:n},o.default.createElement(s.CSSTransition,{nodeRef:this.galleriaRef,classNames:"p-galleria",in:this.state.visible,timeout:{enter:150,exit:150},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntering:this.onEntering,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},i))})}return i}},{key:"render",value:function(){return this.props.value&&this.props.value.length>0&&this.renderGalleria()}}]),v}();I(j,"defaultProps",{id:null,value:null,activeIndex:0,fullScreen:!1,item:null,thumbnail:null,indicator:null,caption:null,className:null,style:null,header:null,footer:null,numVisible:3,responsiveOptions:null,showItemNavigators:!1,showThumbnailNavigators:!0,showItemNavigatorsOnHover:!1,changeItemOnIndicatorHover:!1,circular:!1,autoPlay:!1,transitionInterval:4e3,showThumbnails:!0,thumbnailsPosition:"bottom",verticalThumbnailViewPortHeight:"300px",showIndicators:!1,showIndicatorsOnItem:!1,indicatorsPosition:"bottom",baseZIndex:0,transitionOptions:null,onItemChange:null}),exports.Galleria=j;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils"),i=require("primereact/ripple"),n=require("primereact/api"),r=require("primereact/csstransition"),s=require("primereact/portal");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=a(e),l=a(n);function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p(e,t,i){return t&&c(e.prototype,t),i&&c(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}function v(e){return v="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},v(e)}function f(e,t){if(t&&("object"===v(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function g(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function b(){return b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},b.apply(this,arguments)}function I(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var x=function(n){m(l,e.Component);var r,s,a=(r=l,s=I(),function(){var e,t=y(r);if(s){var i=y(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return f(this,e)});function l(e){var t;return u(this,l),(t=a.call(this,e)).navForward=t.navForward.bind(h(t)),t.navBackward=t.navBackward.bind(h(t)),t.next=t.next.bind(h(t)),t.prev=t.prev.bind(h(t)),t}return p(l,[{key:"step",value:function(e){this.itemsContainer&&(this.itemsContainer.style.transform=this.isVertical()?"translate3d(0, ".concat(100*e,"%, 0)"):"translate3d(".concat(100*e,"%, 0, 0)"),this.itemsContainer.style.transition="transform 500ms ease 0s")}},{key:"next",value:function(){this.props.onActiveItemChange({index:this.props.circular&&this.props.value.length-1===this.props.activeItemIndex?0:this.props.activeItemIndex+1})}},{key:"prev",value:function(){this.props.onActiveItemChange({index:this.props.circular&&0===this.props.activeItemIndex?this.props.value.length-1:0!==this.props.activeItemIndex?this.props.activeItemIndex-1:0})}},{key:"stopSlideShow",value:function(){this.props.slideShowActive&&this.props.stopSlideShow&&this.props.stopSlideShow()}},{key:"navBackward",value:function(e){this.stopSlideShow(),this.prev(),e&&e.cancelable&&e.preventDefault()}},{key:"navForward",value:function(e){this.stopSlideShow(),this.next(),e&&e.cancelable&&e.preventDefault()}},{key:"onIndicatorClick",value:function(e){this.stopSlideShow(),this.props.onActiveItemChange({index:e})}},{key:"onIndicatorMouseEnter",value:function(e){this.props.changeItemOnIndicatorHover&&(this.stopSlideShow(),this.props.onActiveItemChange({index:e}))}},{key:"onIndicatorKeyDown",value:function(e,t){13===e.which&&(this.stopSlideShow(),this.props.onActiveItemChange({index:t}))}},{key:"componentDidMount",value:function(){this.props.autoPlay&&this.props.startSlideShow()}},{key:"renderBackwardNavigator",value:function(){if(this.props.showItemNavigators){var e=!this.props.circular&&0===this.props.activeItemIndex,n=t.classNames("p-galleria-item-prev p-galleria-item-nav p-link",{"p-disabled":e});return o.default.createElement("button",{type:"button",className:n,onClick:this.navBackward,disabled:e},o.default.createElement("span",{className:"p-galleria-item-prev-icon pi pi-chevron-left"}),o.default.createElement(i.Ripple,null))}return null}},{key:"renderForwardNavigator",value:function(){if(this.props.showItemNavigators){var e=!this.props.circular&&this.props.activeItemIndex===this.props.value.length-1,n=t.classNames("p-galleria-item-next p-galleria-item-nav p-link",{"p-disabled":e});return o.default.createElement("button",{type:"button",className:n,onClick:this.navForward,disabled:e},o.default.createElement("span",{className:"p-galleria-item-next-icon pi pi-chevron-right"}),o.default.createElement(i.Ripple,null))}return null}},{key:"renderCaption",value:function(){if(this.props.caption){var e=this.props.caption(this.props.value[this.props.activeItemIndex]);return o.default.createElement("div",{className:"p-galleria-caption"},e)}return null}},{key:"renderIndicator",value:function(e){var n=this,r=this.props.indicator&&this.props.indicator(e),s=t.classNames("p-galleria-indicator",{"p-highlight":this.props.activeItemIndex===e});return r||(r=o.default.createElement("button",{type:"button",tabIndex:-1,className:"p-link"},o.default.createElement(i.Ripple,null))),o.default.createElement("li",{className:s,key:"p-galleria-indicator-"+e,tabIndex:0,onClick:function(){return n.onIndicatorClick(e)},onMouseEnter:function(){return n.onIndicatorMouseEnter(e)},onKeyDown:function(t){return n.onIndicatorKeyDown(t,e)}},r)}},{key:"renderIndicators",value:function(){if(this.props.showIndicators){for(var e=t.classNames("p-galleria-indicators p-reset",this.props.indicatorsContentClassName),i=[],n=0;n<this.props.value.length;n++)i.push(this.renderIndicator(n));return o.default.createElement("ul",{className:e},i)}return null}},{key:"render",value:function(){var e=this,t=this.props.itemTemplate&&this.props.itemTemplate(this.props.value[this.props.activeItemIndex]),i=this.renderBackwardNavigator(),n=this.renderForwardNavigator(),r=this.renderCaption(),s=this.renderIndicators();return o.default.createElement("div",{ref:function(t){return e.props.forwardRef(t)},className:"p-galleria-item-wrapper"},o.default.createElement("div",{className:"p-galleria-item-container"},i,o.default.createElement("div",{className:"p-galleria-item"},t),n,r),s)}}]),l}(),w=o.default.forwardRef((function(e,t){return o.default.createElement(x,b({forwardRef:t},e))}));function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function S(e){if(Array.isArray(e))return k(e)}function E(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function C(e,t){if(e){if("string"==typeof e)return k(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?k(e,t):void 0}}function O(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var N=function(){function e(){u(this,e)}return p(e,null,[{key:"equals",value:function(e,t,i){return i&&e&&"object"===v(e)&&t&&"object"===v(t)?this.resolveFieldData(e,i)===this.resolveFieldData(t,i):this.deepEquals(e,t)}},{key:"deepEquals",value:function(e,t){if(e===t)return!0;if(e&&t&&"object"==v(e)&&"object"==v(t)){var i,n,r,s=Array.isArray(e),a=Array.isArray(t);if(s&&a){if((n=e.length)!==t.length)return!1;for(i=n;0!=i--;)if(!this.deepEquals(e[i],t[i]))return!1;return!0}if(s!==a)return!1;var o=e instanceof Date,l=t instanceof Date;if(o!==l)return!1;if(o&&l)return e.getTime()===t.getTime();var u=e instanceof RegExp,c=t instanceof RegExp;if(u!==c)return!1;if(u&&c)return e.toString()===t.toString();var p=Object.keys(e);if((n=p.length)!==Object.keys(t).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(t,p[i]))return!1;for(i=n;0!=i--;)if(!this.deepEquals(e[r=p[i]],t[r]))return!1;return!0}return e!=e&&t!=t}},{key:"resolveFieldData",value:function(e,t){if(e&&Object.keys(e).length&&t){if(this.isFunction(t))return t(e);if(-1===t.indexOf("."))return e[t];for(var i=t.split("."),n=e,r=0,s=i.length;r<s;++r){if(null==n)return null;n=n[i[r]]}return n}return null}},{key:"isFunction",value:function(e){return!!(e&&e.constructor&&e.call&&e.apply)}},{key:"findDiffKeys",value:function(e,t){return e&&t?Object.keys(e).filter((function(e){return!t.hasOwnProperty(e)})).reduce((function(t,i){return t[i]=e[i],t}),{}):{}}},{key:"reorderArray",value:function(e,t,i){var n;if(e&&t!==i){if(i>=e.length)for(n=i-e.length;1+n--;)e.push(void 0);e.splice(i,0,e.splice(t,1)[0])}}},{key:"findIndexInList",value:function(e,t,i){var n=this;return t?t.findIndex(i?function(t){return n.equals(t,e,i)}:function(t){return t===e}):-1}},{key:"getJSXElement",value:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return this.isFunction(e)?e.apply(void 0,i):e}},{key:"getPropValue",value:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return this.isFunction(e)?e.apply(void 0,i):e}},{key:"getRefElement",value:function(e){return e?"object"===v(e)&&e.hasOwnProperty("current")?e.current:e:null}},{key:"removeAccents",value:function(e){return e&&e.search(/[\xC0-\xFF]/g)>-1&&(e=e.replace(/[\xC0-\xC5]/g,"A").replace(/[\xC6]/g,"AE").replace(/[\xC7]/g,"C").replace(/[\xC8-\xCB]/g,"E").replace(/[\xCC-\xCF]/g,"I").replace(/[\xD0]/g,"D").replace(/[\xD1]/g,"N").replace(/[\xD2-\xD6\xD8]/g,"O").replace(/[\xD9-\xDC]/g,"U").replace(/[\xDD]/g,"Y").replace(/[\xDE]/g,"P").replace(/[\xE0-\xE5]/g,"a").replace(/[\xE6]/g,"ae").replace(/[\xE7]/g,"c").replace(/[\xE8-\xEB]/g,"e").replace(/[\xEC-\xEF]/g,"i").replace(/[\xF1]/g,"n").replace(/[\xF2-\xF6\xF8]/g,"o").replace(/[\xF9-\xFC]/g,"u").replace(/[\xFE]/g,"p").replace(/[\xFD\xFF]/g,"y")),e}},{key:"isEmpty",value:function(e){return null==e||""===e||Array.isArray(e)&&0===e.length||!(e instanceof Date)&&"object"===v(e)&&0===Object.keys(e).length}},{key:"isNotEmpty",value:function(e){return!this.isEmpty(e)}},{key:"sort",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3?arguments[3]:void 0;return i*(null==e&&null!=t?-1:null!=e&&null==t?1:null==e&&null==t?0:"string"==typeof e&&"string"==typeof t?e.localeCompare(t,n,{numeric:!0}):e<t?-1:e>t?1:0)}}]),e}();function P(e){var t=V();return function(){var i,n=y(e);if(t){var r=y(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return f(this,i)}}function V(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var D=function(i){m(r,e.Component);var n=P(r);function r(e){var t;return u(this,r),(t=n.call(this,e)).onItemClick=t.onItemClick.bind(h(t)),t.onItemKeyDown=t.onItemKeyDown.bind(h(t)),t}return p(r,[{key:"onItemClick",value:function(e){this.props.onItemClick({originalEvent:e,index:this.props.index})}},{key:"onItemKeyDown",value:function(e){13===e.which&&this.props.onItemClick({originalEvent:e,index:this.props.index})}},{key:"render",value:function(){var e=this.props.template&&this.props.template(this.props.item),i=t.classNames(this.props.className,"p-galleria-thumbnail-item",{"p-galleria-thumbnail-item-current":this.props.current,"p-galleria-thumbnail-item-active":this.props.active,"p-galleria-thumbnail-item-start":this.props.start,"p-galleria-thumbnail-item-end":this.props.end});return o.default.createElement("div",{className:i},o.default.createElement("div",{className:"p-galleria-thumbnail-item-content",tabIndex:this.props.active?0:null,onClick:this.onItemClick,onKeyDown:this.onItemKeyDown},e))}}]),r}();g(D,"defaultProps",{index:null,template:null,item:null,current:!1,active:!1,start:!1,end:!1,className:null,onItemClick:null});var T=function(n){m(s,e.Component);var r=P(s);function s(e){var i;return u(this,s),(i=r.call(this,e)).state={numVisible:e.numVisible,totalShiftedItems:0,page:0},i.navForward=i.navForward.bind(h(i)),i.navBackward=i.navBackward.bind(h(i)),i.onTransitionEnd=i.onTransitionEnd.bind(h(i)),i.onTouchStart=i.onTouchStart.bind(h(i)),i.onTouchMove=i.onTouchMove.bind(h(i)),i.onTouchEnd=i.onTouchEnd.bind(h(i)),i.onItemClick=i.onItemClick.bind(h(i)),i.attributeSelector=t.UniqueComponentId(),i}return p(s,[{key:"step",value:function(e){var i=this.state.totalShiftedItems+e;e<0&&-1*i+this.state.numVisible>this.props.value.length-1?i=this.state.numVisible-this.props.value.length:e>0&&i>0&&(i=0),this.props.circular&&(e<0&&this.props.value.length-1===this.props.activeItemIndex?i=0:e>0&&0===this.props.activeItemIndex&&(i=this.state.numVisible-this.props.value.length)),this.itemsContainer&&(t.DomHandler.removeClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transform=this.props.isVertical?"translate3d(0, ".concat(i*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(i*(100/this.state.numVisible),"%, 0, 0)"),this.itemsContainer.style.transition="transform 500ms ease 0s"),this.setState({totalShiftedItems:i})}},{key:"stopSlideShow",value:function(){this.props.slideShowActive&&this.props.stopSlideShow&&this.props.stopSlideShow()}},{key:"getMedianItemIndex",value:function(){var e=Math.floor(this.state.numVisible/2);return this.state.numVisible%2?e:e-1}},{key:"navBackward",value:function(e){this.stopSlideShow();var t=0!==this.props.activeItemIndex?this.props.activeItemIndex-1:0;this.state.numVisible-(t+this.state.totalShiftedItems)-1>this.getMedianItemIndex()&&(-1*this.state.totalShiftedItems!=0||this.props.circular)&&this.step(1),this.props.onActiveItemChange({index:this.props.circular&&0===this.props.activeItemIndex?this.props.value.length-1:t}),e.cancelable&&e.preventDefault()}},{key:"navForward",value:function(e){this.stopSlideShow();var t=this.props.activeItemIndex+1;t+this.state.totalShiftedItems>this.getMedianItemIndex()&&(-1*this.state.totalShiftedItems<this.getTotalPageNumber()-1||this.props.circular)&&this.step(-1),this.props.onActiveItemChange({index:this.props.circular&&this.props.value.length-1===this.props.activeItemIndex?0:t}),e.cancelable&&e.preventDefault()}},{key:"onItemClick",value:function(e){this.stopSlideShow();var t=e.index;if(t!==this.props.activeItemIndex){var i=t+this.state.totalShiftedItems,n=0;t<this.props.activeItemIndex?(n=this.state.numVisible-i-1-this.getMedianItemIndex())>0&&-1*this.state.totalShiftedItems!=0&&this.step(n):(n=this.getMedianItemIndex()-i)<0&&-1*this.state.totalShiftedItems<this.getTotalPageNumber()-1&&this.step(n),this.props.onActiveItemChange({index:t})}}},{key:"onTransitionEnd",value:function(e){this.itemsContainer&&"transform"===e.propertyName&&(t.DomHandler.addClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="")}},{key:"onTouchStart",value:function(e){var t=e.changedTouches[0];this.startPos={x:t.pageX,y:t.pageY}}},{key:"onTouchMove",value:function(e){e.cancelable&&e.preventDefault()}},{key:"onTouchEnd",value:function(e){var t=e.changedTouches[0];this.changePageOnTouch(e,this.props.isVertical?t.pageY-this.startPos.y:t.pageX-this.startPos.x)}},{key:"changePageOnTouch",value:function(e,t){t<0?this.navForward(e):this.navBackward(e)}},{key:"getTotalPageNumber",value:function(){return this.props.value.length>this.state.numVisible?this.props.value.length-this.state.numVisible+1:0}},{key:"createStyle",value:function(){this.thumbnailsStyle||(this.thumbnailsStyle=t.DomHandler.createInlineStyle(l.default.nonce));var e,i="\n .p-galleria-thumbnail-items[".concat(this.attributeSelector,"] .p-galleria-thumbnail-item {\n flex: 1 0 ").concat(100/this.state.numVisible,"%\n }\n ");if(this.props.responsiveOptions){this.responsiveOptions=S(e=this.props.responsiveOptions)||E(e)||C(e)||O(),this.responsiveOptions.sort((function(e,t){return N.sort(e.breakpoint,t.breakpoint,-1,l.default.locale)}));for(var n=0;n<this.responsiveOptions.length;n++){var r=this.responsiveOptions[n];i+="\n @media screen and (max-width: ".concat(r.breakpoint,") {\n .p-galleria-thumbnail-items[").concat(this.attributeSelector,"] .p-galleria-thumbnail-item {\n flex: 1 0 ").concat(100/r.numVisible,"%\n }\n }\n ")}}this.thumbnailsStyle.innerHTML=i}},{key:"calculatePosition",value:function(){if(this.itemsContainer&&this.responsiveOptions){for(var e=window.innerWidth,t={numVisible:this.props.numVisible},i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];parseInt(n.breakpoint,10)>=e&&(t=n)}this.state.numVisible!==t.numVisible&&this.setState({numVisible:t.numVisible})}}},{key:"bindDocumentListeners",value:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(){e.calculatePosition()},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentListeners",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"componentDidMount",value:function(){this.itemsContainer&&this.itemsContainer.setAttribute(this.attributeSelector,""),this.createStyle(),this.calculatePosition(),this.props.responsiveOptions&&this.bindDocumentListeners()}},{key:"componentDidUpdate",value:function(e,i){var n=this.state.totalShiftedItems;i.numVisible===this.state.numVisible&&e.activeItemIndex===this.props.activeItemIndex||((n=this.props.activeItemIndex<=this.getMedianItemIndex()?0:this.props.value.length-this.state.numVisible+this.getMedianItemIndex()<this.props.activeItemIndex?this.state.numVisible-this.props.value.length:this.props.value.length-this.state.numVisible<this.props.activeItemIndex&&this.state.numVisible%2==0?-1*this.props.activeItemIndex+this.getMedianItemIndex()+1:-1*this.props.activeItemIndex+this.getMedianItemIndex())!==this.state.totalShiftedItems&&this.setState({totalShiftedItems:n}),this.itemsContainer.style.transform=this.props.isVertical?"translate3d(0, ".concat(n*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(n*(100/this.state.numVisible),"%, 0, 0)"),e.activeItemIndex!==this.props.activeItemIndex&&(t.DomHandler.removeClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="transform 500ms ease 0s"))}},{key:"componentWillUnmount",value:function(){this.props.responsiveOptions&&this.unbindDocumentListeners()}},{key:"renderItems",value:function(){var e=this;return this.props.value.map((function(t,i){var n=-1*e.state.totalShiftedItems,r=n+e.state.numVisible-1;return o.default.createElement(D,{key:i,index:i,template:e.props.itemTemplate,item:t,active:n<=i&&r>=i,start:n===i,end:r===i,onItemClick:e.onItemClick,current:e.props.activeItemIndex===i})}))}},{key:"renderBackwardNavigator",value:function(){if(this.props.showThumbnailNavigators){var e=!this.props.circular&&0===this.props.activeItemIndex||this.props.value.length<=this.state.numVisible,n=t.classNames("p-galleria-thumbnail-prev p-link",{"p-disabled":e}),r=t.classNames("p-galleria-thumbnail-prev-icon pi",{"pi-chevron-left":!this.props.isVertical,"pi-chevron-up":this.props.isVertical});return o.default.createElement("button",{className:n,onClick:this.navBackward,disabled:e},o.default.createElement("span",{className:r}),o.default.createElement(i.Ripple,null))}return null}},{key:"renderForwardNavigator",value:function(){if(this.props.showThumbnailNavigators){var e=!this.props.circular&&this.props.activeItemIndex===this.props.value.length-1||this.props.value.length<=this.state.numVisible,n=t.classNames("p-galleria-thumbnail-next p-link",{"p-disabled":e}),r=t.classNames("p-galleria-thumbnail-next-icon pi",{"pi-chevron-right":!this.props.isVertical,"pi-chevron-down":this.props.isVertical});return o.default.createElement("button",{className:n,onClick:this.navForward,disabled:e},o.default.createElement("span",{className:r}),o.default.createElement(i.Ripple,null))}return null}},{key:"renderContent",value:function(){var e=this,t=this.renderItems(),i=this.props.isVertical?this.props.contentHeight:"",n=this.renderBackwardNavigator(),r=this.renderForwardNavigator();return o.default.createElement("div",{className:"p-galleria-thumbnail-container"},n,o.default.createElement("div",{className:"p-galleria-thumbnail-items-container",style:{height:i}},o.default.createElement("div",{ref:function(t){return e.itemsContainer=t},className:"p-galleria-thumbnail-items",onTransitionEnd:this.onTransitionEnd,onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd},t)),r)}},{key:"render",value:function(){var e=this.renderContent();return o.default.createElement("div",{className:"p-galleria-thumbnail-wrapper"},e)}}]),s}();function A(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function j(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?A(Object(i),!0).forEach((function(t){g(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):A(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function R(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var F=function(n){m(v,e.Component);var a,c,d=(a=v,c=R(),function(){var e,t=y(a);if(c){var i=y(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return f(this,e)});function v(e){var t;return u(this,v),(t=d.call(this,e)).state={visible:!1,numVisible:e.numVisible,slideShowActive:!1},t.props.onItemChange||(t.state=j(j({},t.state),{},{activeIndex:e.activeIndex})),t.onActiveItemChange=t.onActiveItemChange.bind(h(t)),t.show=t.show.bind(h(t)),t.hide=t.hide.bind(h(t)),t.startSlideShow=t.startSlideShow.bind(h(t)),t.stopSlideShow=t.stopSlideShow.bind(h(t)),t.onEnter=t.onEnter.bind(h(t)),t.onEntering=t.onEntering.bind(h(t)),t.onEntered=t.onEntered.bind(h(t)),t.onExit=t.onExit.bind(h(t)),t.onExited=t.onExited.bind(h(t)),t.galleriaRef=o.default.createRef(),t}return p(v,[{key:"activeItemIndex",get:function(){return this.props.onItemChange?this.props.activeIndex:this.state.activeIndex}},{key:"onActiveItemChange",value:function(e){this.props.onItemChange?this.props.onItemChange(e):this.setState({activeIndex:e.index})}},{key:"show",value:function(){this.setState({visible:!0})}},{key:"hide",value:function(){this.setState({visible:!1})}},{key:"onEnter",value:function(){t.DomHandler.addClass(document.body,"p-overflow-hidden")}},{key:"onEntering",value:function(){t.ZIndexUtils.set("modal",this.mask,l.default.autoZIndex,this.props.baseZIndex||l.default.zIndex.modal),t.DomHandler.addMultipleClasses(this.mask,"p-component-overlay p-component-overlay-enter")}},{key:"onEntered",value:function(){this.props.onShow&&this.props.onShow()}},{key:"onExit",value:function(){t.DomHandler.removeClass(document.body,"p-overflow-hidden"),t.DomHandler.addClass(this.mask,"p-component-overlay-leave")}},{key:"onExited",value:function(){t.ZIndexUtils.clear(this.mask),this.props.onHide&&this.props.onHide()}},{key:"isAutoPlayActive",value:function(){return this.state.slideShowActive}},{key:"startSlideShow",value:function(){var e=this;this.interval=setInterval((function(){e.onActiveItemChange({index:e.props.circular&&e.props.value.length-1===e.activeItemIndex?0:e.activeItemIndex+1})}),this.props.transitionInterval),this.setState({slideShowActive:!0})}},{key:"stopSlideShow",value:function(){this.interval&&clearInterval(this.interval),this.setState({slideShowActive:!1})}},{key:"getPositionClassName",value:function(e,t){var i=["top","left","bottom","right"].find((function(e){return e===t}));return i?"".concat(e,"-").concat(i):""}},{key:"isVertical",value:function(){return"left"===this.props.thumbnailsPosition||"right"===this.props.thumbnailsPosition}},{key:"componentDidUpdate",value:function(e,t){e.value!==this.props.value&&this.props.value&&this.props.value.length<this.state.numVisible&&this.setState({numVisible:this.props.value.length}),e.numVisible!==this.props.numVisible&&this.setState({numVisible:this.props.numVisible})}},{key:"componentWillUnmount",value:function(){this.state.slideShowActive&&this.stopSlideShow(),t.ZIndexUtils.clear(this.mask)}},{key:"renderHeader",value:function(){return this.props.header?o.default.createElement("div",{className:"p-galleria-header"},this.props.header):null}},{key:"renderFooter",value:function(){return this.props.footer?o.default.createElement("div",{className:"p-galleria-footer"},this.props.footer):null}},{key:"renderElement",value:function(){var e=this,n=this.isVertical(),r=this.props.showThumbnails&&this.getPositionClassName("p-galleria-thumbnails",this.props.thumbnailsPosition),s=this.props.showIndicators&&this.getPositionClassName("p-galleria-indicators",this.props.indicatorsPosition),a=t.classNames("p-galleria p-component",this.props.className,{"p-galleria-fullscreen":this.props.fullScreen,"p-galleria-indicator-onitem":this.props.showIndicatorsOnItem,"p-galleria-item-nav-onhover":this.props.showItemNavigatorsOnHover&&!this.props.fullScreen},r,s),l=this.props.fullScreen&&o.default.createElement("button",{type:"button",className:"p-galleria-close p-link",onClick:this.hide},o.default.createElement("span",{className:"p-galleria-close-icon pi pi-times"}),o.default.createElement(i.Ripple,null)),u=this.renderHeader(),c=this.renderFooter();return o.default.createElement("div",{ref:this.galleriaRef,id:this.props.id,className:a,style:this.props.style},l,u,o.default.createElement("div",{className:"p-galleria-content"},o.default.createElement(w,{ref:function(t){return e.previewContent=t},value:this.props.value,activeItemIndex:this.activeItemIndex,onActiveItemChange:this.onActiveItemChange,itemTemplate:this.props.item,circular:this.props.circular,caption:this.props.caption,showIndicators:this.props.showIndicators,changeItemOnIndicatorHover:this.props.changeItemOnIndicatorHover,indicator:this.props.indicator,showItemNavigators:this.props.showItemNavigators,autoPlay:this.props.autoPlay,slideShowActive:this.state.slideShowActive,startSlideShow:this.startSlideShow,stopSlideShow:this.stopSlideShow}),this.props.showThumbnails&&o.default.createElement(T,{value:this.props.value,activeItemIndex:this.activeItemIndex,onActiveItemChange:this.onActiveItemChange,itemTemplate:this.props.thumbnail,numVisible:this.state.numVisible,responsiveOptions:this.props.responsiveOptions,circular:this.props.circular,isVertical:n,contentHeight:this.props.verticalThumbnailViewPortHeight,showThumbnailNavigators:this.props.showThumbnailNavigators,autoPlay:this.props.autoPlay,slideShowActive:this.state.slideShowActive,stopSlideShow:this.stopSlideShow})),c)}},{key:"renderGalleria",value:function(){var e=this,i=this.renderElement();if(this.props.fullScreen){var n=t.classNames("p-galleria-mask",{"p-galleria-visible":this.state.visible});return o.default.createElement(s.Portal,{element:o.default.createElement("div",{ref:function(t){return e.mask=t},className:n},o.default.createElement(r.CSSTransition,{nodeRef:this.galleriaRef,classNames:"p-galleria",in:this.state.visible,timeout:{enter:150,exit:150},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntering:this.onEntering,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},i))})}return i}},{key:"render",value:function(){return this.props.value&&this.props.value.length>0&&this.renderGalleria()}}]),v}();g(F,"defaultProps",{id:null,value:null,activeIndex:0,fullScreen:!1,item:null,thumbnail:null,indicator:null,caption:null,className:null,style:null,header:null,footer:null,numVisible:3,responsiveOptions:null,showItemNavigators:!1,showThumbnailNavigators:!0,showItemNavigatorsOnHover:!1,changeItemOnIndicatorHover:!1,circular:!1,autoPlay:!1,transitionInterval:4e3,showThumbnails:!0,thumbnailsPosition:"bottom",verticalThumbnailViewPortHeight:"300px",showIndicators:!1,showIndicatorsOnItem:!1,indicatorsPosition:"bottom",baseZIndex:0,transitionOptions:null,onItemChange:null}),exports.Galleria=F;
|