primereact 7.0.1 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/accordion/accordion.cjs.js +12 -6
- package/accordion/accordion.cjs.min.js +1 -1
- package/accordion/accordion.d.ts +5 -2
- package/accordion/accordion.esm.js +12 -6
- package/accordion/accordion.esm.min.js +1 -1
- package/accordion/accordion.js +12 -6
- package/accordion/accordion.min.js +1 -1
- package/api/api.cjs.js +2 -0
- package/api/api.cjs.min.js +1 -1
- package/api/api.d.ts +30 -30
- package/api/api.esm.js +2 -0
- package/api/api.esm.min.js +1 -1
- package/api/api.js +2 -0
- package/api/api.min.js +1 -1
- package/autocomplete/autocomplete.cjs.js +4 -4
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.d.ts +9 -4
- package/autocomplete/autocomplete.esm.js +4 -4
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +4 -4
- package/autocomplete/autocomplete.min.js +1 -1
- package/avatar/avatar.d.ts +1 -1
- package/blockui/blockui.cjs.js +12 -5
- package/blockui/blockui.cjs.min.js +1 -1
- package/blockui/blockui.esm.js +12 -5
- package/blockui/blockui.esm.min.js +1 -1
- package/blockui/blockui.js +12 -5
- package/blockui/blockui.min.js +1 -1
- package/button/button.d.ts +1 -1
- package/calendar/calendar.cjs.js +22 -3
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.d.ts +3 -2
- package/calendar/calendar.esm.js +22 -3
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +22 -3
- package/calendar/calendar.min.js +1 -1
- package/carousel/carousel.cjs.js +8 -9
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +8 -9
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +8 -9
- package/carousel/carousel.min.js +1 -1
- package/cascadeselect/cascadeselect.cjs.js +1 -1
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.d.ts +2 -1
- package/cascadeselect/cascadeselect.esm.js +1 -1
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +1 -1
- package/cascadeselect/cascadeselect.min.js +1 -1
- package/checkbox/checkbox.d.ts +1 -1
- package/chip/chip.d.ts +1 -1
- package/colorpicker/colorpicker.cjs.js +1 -1
- package/colorpicker/colorpicker.cjs.min.js +1 -1
- package/colorpicker/colorpicker.d.ts +19 -5
- package/colorpicker/colorpicker.esm.js +1 -1
- package/colorpicker/colorpicker.esm.min.js +1 -1
- package/colorpicker/colorpicker.js +1 -1
- package/colorpicker/colorpicker.min.js +1 -1
- package/column/column.d.ts +1 -1
- package/confirmdialog/confirmdialog.d.ts +1 -1
- package/confirmpopup/confirmpopup.cjs.js +2 -2
- package/confirmpopup/confirmpopup.cjs.min.js +1 -1
- package/confirmpopup/confirmpopup.d.ts +3 -2
- package/confirmpopup/confirmpopup.esm.js +2 -2
- package/confirmpopup/confirmpopup.esm.min.js +1 -1
- package/confirmpopup/confirmpopup.js +2 -2
- package/confirmpopup/confirmpopup.min.js +1 -1
- package/contextmenu/contextmenu.cjs.js +1 -1
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.d.ts +2 -1
- package/contextmenu/contextmenu.esm.js +1 -1
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +1 -1
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +185 -68
- package/core/core.min.js +9 -9
- package/csstransition/csstransition.cjs.js +49 -19
- package/csstransition/csstransition.cjs.min.js +1 -1
- package/csstransition/csstransition.d.ts +8 -0
- package/csstransition/csstransition.esm.js +48 -19
- package/csstransition/csstransition.esm.min.js +1 -1
- package/csstransition/csstransition.js +49 -21
- package/csstransition/csstransition.min.js +1 -1
- package/csstransition/package.json +2 -1
- package/datatable/datatable.cjs.js +238 -186
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.d.ts +25 -11
- package/datatable/datatable.esm.js +238 -186
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +238 -186
- package/datatable/datatable.min.js +1 -1
- package/dialog/dialog.cjs.js +2 -8
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.d.ts +2 -1
- package/dialog/dialog.esm.js +2 -8
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +2 -8
- package/dialog/dialog.min.js +1 -1
- package/dropdown/dropdown.cjs.js +14 -4
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.d.ts +2 -1
- package/dropdown/dropdown.esm.js +14 -4
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +14 -4
- package/dropdown/dropdown.min.js +1 -1
- package/editor/editor.cjs.js +6 -2
- package/editor/editor.cjs.min.js +1 -1
- package/editor/editor.d.ts +1 -0
- package/editor/editor.esm.js +6 -2
- package/editor/editor.esm.min.js +1 -1
- package/editor/editor.js +6 -2
- package/editor/editor.min.js +1 -1
- package/fieldset/fieldset.d.ts +2 -1
- package/fileupload/fileupload.d.ts +1 -1
- package/galleria/galleria.cjs.js +1 -2
- package/galleria/galleria.cjs.min.js +1 -1
- package/galleria/galleria.d.ts +2 -1
- package/galleria/galleria.esm.js +1 -2
- package/galleria/galleria.esm.min.js +1 -1
- package/galleria/galleria.js +1 -2
- package/galleria/galleria.min.js +1 -1
- package/inputmask/inputmask.cjs.js +2 -2
- package/inputmask/inputmask.cjs.min.js +1 -1
- package/inputmask/inputmask.d.ts +1 -1
- package/inputmask/inputmask.esm.js +2 -2
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +2 -2
- package/inputmask/inputmask.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +10 -5
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.d.ts +4 -4
- package/inputnumber/inputnumber.esm.js +10 -5
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +10 -5
- package/inputnumber/inputnumber.min.js +1 -1
- package/mention/mention.cjs.js +1 -1
- package/mention/mention.cjs.min.js +1 -1
- package/mention/mention.d.ts +2 -1
- package/mention/mention.esm.js +1 -1
- package/mention/mention.esm.min.js +1 -1
- package/mention/mention.js +1 -1
- package/mention/mention.min.js +1 -1
- package/menu/menu.cjs.js +1 -1
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.d.ts +2 -1
- package/menu/menu.esm.js +1 -1
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +1 -1
- package/menu/menu.min.js +1 -1
- package/menubar/menubar.min.css +1 -1
- package/messages/messages.d.ts +2 -1
- package/multiselect/multiselect.cjs.js +2 -2
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.d.ts +3 -2
- package/multiselect/multiselect.esm.js +2 -2
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +2 -2
- package/multiselect/multiselect.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.d.ts +1 -1
- package/organizationchart/organizationchart.min.css +1 -1
- package/overlaypanel/overlaypanel.cjs.js +3 -7
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.d.ts +2 -1
- package/overlaypanel/overlaypanel.esm.js +3 -7
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +3 -7
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/package.json +3 -2
- package/panel/panel.cjs.js +3 -2
- package/panel/panel.cjs.min.js +1 -1
- package/panel/panel.d.ts +5 -3
- package/panel/panel.esm.js +4 -3
- package/panel/panel.esm.min.js +1 -1
- package/panel/panel.js +3 -2
- package/panel/panel.min.js +1 -1
- package/panelmenu/panelmenu.d.ts +2 -1
- package/password/password.cjs.js +1 -1
- package/password/password.cjs.min.js +1 -1
- package/password/password.d.ts +2 -1
- package/password/password.esm.js +1 -1
- package/password/password.esm.min.js +1 -1
- package/password/password.js +1 -1
- package/password/password.min.js +1 -1
- package/portal/portal.cjs.js +2 -6
- package/portal/portal.cjs.min.js +1 -1
- package/portal/portal.esm.js +2 -6
- package/portal/portal.esm.min.js +1 -1
- package/portal/portal.js +3 -8
- package/portal/portal.min.js +1 -1
- package/primereact.all.cjs.js +850 -630
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +850 -630
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +850 -630
- package/primereact.all.min.js +1 -1
- package/resources/primereact.css +356 -354
- package/resources/primereact.min.css +1 -1
- package/resources/themes/arya-blue/theme.css +4 -0
- package/resources/themes/arya-green/theme.css +4 -0
- package/resources/themes/arya-orange/theme.css +4 -0
- package/resources/themes/arya-purple/theme.css +4 -0
- package/resources/themes/bootstrap4-dark-blue/theme.css +4 -0
- package/resources/themes/bootstrap4-dark-purple/theme.css +4 -0
- package/resources/themes/bootstrap4-light-blue/theme.css +4 -0
- package/resources/themes/bootstrap4-light-purple/theme.css +4 -0
- package/resources/themes/fluent-light/theme.css +4 -0
- package/resources/themes/lara-dark-blue/theme.css +26 -22
- package/resources/themes/lara-dark-indigo/theme.css +26 -22
- package/resources/themes/lara-dark-purple/theme.css +26 -22
- package/resources/themes/lara-dark-teal/theme.css +26 -22
- package/resources/themes/lara-light-blue/theme.css +4 -0
- package/resources/themes/lara-light-indigo/theme.css +4 -0
- package/resources/themes/lara-light-purple/theme.css +4 -0
- package/resources/themes/lara-light-teal/theme.css +4 -0
- package/resources/themes/luna-amber/theme.css +4 -0
- package/resources/themes/luna-blue/theme.css +4 -0
- package/resources/themes/luna-green/theme.css +4 -0
- package/resources/themes/luna-pink/theme.css +4 -0
- package/resources/themes/md-dark-deeppurple/theme.css +4 -0
- package/resources/themes/md-dark-indigo/theme.css +4 -0
- package/resources/themes/md-light-deeppurple/theme.css +4 -0
- package/resources/themes/md-light-indigo/theme.css +4 -0
- package/resources/themes/mdc-dark-deeppurple/theme.css +4 -0
- package/resources/themes/mdc-dark-indigo/theme.css +4 -0
- package/resources/themes/mdc-light-deeppurple/theme.css +4 -0
- package/resources/themes/mdc-light-indigo/theme.css +4 -0
- package/resources/themes/nova/theme.css +4 -0
- package/resources/themes/nova-accent/theme.css +4 -0
- package/resources/themes/nova-alt/theme.css +4 -0
- package/resources/themes/rhea/theme.css +4 -0
- package/resources/themes/saga-blue/theme.css +4 -0
- package/resources/themes/saga-green/theme.css +4 -0
- package/resources/themes/saga-orange/theme.css +4 -0
- package/resources/themes/saga-purple/theme.css +4 -0
- package/resources/themes/tailwind-light/theme.css +4 -0
- package/resources/themes/vela-blue/theme.css +4 -0
- package/resources/themes/vela-green/theme.css +4 -0
- package/resources/themes/vela-orange/theme.css +4 -0
- package/resources/themes/vela-purple/theme.css +4 -0
- package/scrolltop/scrolltop.d.ts +3 -2
- package/selectitem/selectitem.d.ts +1 -1
- package/sidebar/sidebar.d.ts +2 -1
- package/slidemenu/slidemenu.cjs.js +1 -1
- package/slidemenu/slidemenu.cjs.min.js +1 -1
- package/slidemenu/slidemenu.d.ts +2 -1
- package/slidemenu/slidemenu.esm.js +1 -1
- package/slidemenu/slidemenu.esm.min.js +1 -1
- package/slidemenu/slidemenu.js +1 -1
- package/slidemenu/slidemenu.min.js +1 -1
- package/speeddial/speeddial.d.ts +1 -1
- package/splitbutton/splitbutton.cjs.js +7 -3
- package/splitbutton/splitbutton.cjs.min.js +1 -1
- package/splitbutton/splitbutton.d.ts +5 -2
- package/splitbutton/splitbutton.esm.js +7 -3
- package/splitbutton/splitbutton.esm.min.js +1 -1
- package/splitbutton/splitbutton.js +7 -3
- package/splitbutton/splitbutton.min.js +1 -1
- package/tabview/tabview.cjs.js +21 -4
- package/tabview/tabview.cjs.min.js +1 -1
- package/tabview/tabview.d.ts +8 -0
- package/tabview/tabview.esm.js +21 -4
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +21 -4
- package/tabview/tabview.min.js +1 -1
- package/tag/tag.d.ts +1 -1
- package/tieredmenu/tieredmenu.cjs.js +1 -1
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.d.ts +2 -1
- package/tieredmenu/tieredmenu.esm.js +1 -1
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +1 -1
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/toast/toast.d.ts +2 -1
- package/togglebutton/togglebutton.d.ts +1 -1
- package/tooltip/tooltip.cjs.js +32 -6
- package/tooltip/tooltip.cjs.min.js +1 -1
- package/tooltip/tooltip.d.ts +0 -1
- package/tooltip/tooltip.esm.js +32 -6
- package/tooltip/tooltip.esm.min.js +1 -1
- package/tooltip/tooltip.js +32 -6
- package/tooltip/tooltip.min.js +1 -1
- package/tooltip/tooltipoptions.d.ts +2 -0
- package/tree/tree.d.ts +8 -4
- package/treenode/treenode.d.ts +1 -1
- package/treeselect/treeselect.cjs.js +1 -1
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.d.ts +2 -1
- package/treeselect/treeselect.esm.js +1 -1
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +1 -1
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/treetable.cjs.js +48 -1
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.d.ts +1 -1
- package/treetable/treetable.esm.js +48 -1
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +48 -1
- package/treetable/treetable.min.js +1 -1
- package/utils/utils.cjs.js +48 -1
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.d.ts +1 -0
- package/utils/utils.esm.js +48 -1
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +48 -1
- package/utils/utils.min.js +1 -1
- package/virtualscroller/virtualscroller.cjs.js +27 -17
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.esm.js +27 -17
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +27 -17
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +2 -2
- package/util.d.ts +0 -1
package/calendar/calendar.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.calendar=function(e,t,n,i,r,s,a,o,l,u,p){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=c(t),d=c(u);function m(){return m=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},m.apply(this,arguments)}function f(e){return f="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},f(e)}function v(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(e){if(Array.isArray(e))return v(e)}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function D(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}function k(){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 M(e){return g(e)||y(e)||D(e)||k()}function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(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 S(e,t,n){return t&&w(e.prototype,t),n&&w(e,n),e}function E(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e,t){return C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},C(e,t)}function T(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}}),t&&C(e,t)}function x(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return E(e)}function I(e){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},I(e)}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N(){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(e){T(a,e);var t,n,i=(t=a,n=N(),function(){var e,i=I(t);if(n){var r=I(this).constructor;e=Reflect.construct(i,arguments,r)}else e=i.apply(this,arguments);return x(this,e)});function a(){return b(this,a),i.apply(this,arguments)}return S(a,[{key:"renderElement",value:function(){return h.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.props.onEnter,onEntered:this.props.onEntered,onExit:this.props.onExit,onExited:this.props.onExited},h.default.createElement("div",{ref:this.props.forwardRef,className:this.props.className,style:this.props.style,onClick:this.props.onClick,onMouseUp:this.props.onMouseUp},this.props.children))}},{key:"render",value:function(){var e=this.renderElement();return this.props.inline?e:h.default.createElement(s.Portal,{element:e,appendTo:this.props.appendTo})}}]),a}(t.Component);O(F,"defaultProps",{appendTo:null,style:null,className:null});var H=h.default.forwardRef((function(e,t){return h.default.createElement(F,m({forwardRef:t},e))}));function P(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=R(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 s,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw s}}}}function R(e,t){if(e){if("string"==typeof e)return B(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)?B(e,t):void 0}}function B(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 V(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 Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach((function(t){O(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function U(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var L=function(e){T(v,e);var r,s,c=(r=v,s=U(),function(){var e,t=I(r);if(s){var n=I(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return x(this,e)});function v(e){var n;if(b(this,v),(n=c.call(this,e)).state={focused:!1,overlayVisible:!1},!n.props.onViewDateChange){var i=n.getViewDate(n.props.viewDate);n.validateDate(i),n.state=Y(Y({},n.state),{},{viewDate:i})}return n.navigation=null,n.onUserInput=n.onUserInput.bind(E(n)),n.onInputFocus=n.onInputFocus.bind(E(n)),n.onInputBlur=n.onInputBlur.bind(E(n)),n.onInputKeyDown=n.onInputKeyDown.bind(E(n)),n.onButtonClick=n.onButtonClick.bind(E(n)),n.onPrevButtonClick=n.onPrevButtonClick.bind(E(n)),n.onNextButtonClick=n.onNextButtonClick.bind(E(n)),n.onMonthDropdownChange=n.onMonthDropdownChange.bind(E(n)),n.onYearDropdownChange=n.onYearDropdownChange.bind(E(n)),n.onTodayButtonClick=n.onTodayButtonClick.bind(E(n)),n.onClearButtonClick=n.onClearButtonClick.bind(E(n)),n.onPanelClick=n.onPanelClick.bind(E(n)),n.onPanelMouseUp=n.onPanelMouseUp.bind(E(n)),n.incrementHour=n.incrementHour.bind(E(n)),n.decrementHour=n.decrementHour.bind(E(n)),n.incrementMinute=n.incrementMinute.bind(E(n)),n.decrementMinute=n.decrementMinute.bind(E(n)),n.incrementSecond=n.incrementSecond.bind(E(n)),n.decrementSecond=n.decrementSecond.bind(E(n)),n.toggleAmPm=n.toggleAmPm.bind(E(n)),n.onTimePickerElementMouseDown=n.onTimePickerElementMouseDown.bind(E(n)),n.onTimePickerElementMouseUp=n.onTimePickerElementMouseUp.bind(E(n)),n.onTimePickerElementMouseLeave=n.onTimePickerElementMouseLeave.bind(E(n)),n.onOverlayEnter=n.onOverlayEnter.bind(E(n)),n.onOverlayEntered=n.onOverlayEntered.bind(E(n)),n.onOverlayExit=n.onOverlayExit.bind(E(n)),n.onOverlayExited=n.onOverlayExited.bind(E(n)),n.reFocusInputField=n.reFocusInputField.bind(E(n)),n.overlayRef=t.createRef(),n.inputRef=t.createRef(n.props.inputRef),n}return S(v,[{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(){var e=this;this.updateInputRef(),this.props.tooltip&&this.renderTooltip(),this.props.inline?this.initFocusableCell():this.props.mask&&a.mask(this.inputRef.current,{mask:this.props.mask,readOnly:this.props.readOnlyInput||this.props.disabled,onChange:function(t){return e.updateValueOnInput(t.originalEvent,t.value)}}),this.props.value&&this.updateInputfield(this.props.value)}},{key:"componentDidUpdate",value:function(e){var t=this;if(e.tooltip===this.props.tooltip&&e.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(Y({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),!this.props.onViewDateChange&&!this.viewStateChanged){var n=this.props.value;Array.isArray(n)&&(n=n[0]);var i=e.value;if(Array.isArray(i)&&(i=i[0]),!i&&n||n&&n instanceof Date&&n.getTime()!==i.getTime()){var r=this.props.viewDate&&this.isValidDate(this.props.viewDate)?this.props.viewDate:n&&this.isValidDate(n)?n:new Date;this.validateDate(r),this.setState({viewDate:r},(function(){t.viewStateChanged=!0}))}}this.overlayRef&&this.overlayRef.current&&this.updateFocus(),(e.value===this.props.value||this.viewStateChanged&&this.isVisible())&&!this.isOptionChanged(e)||this.updateInputfield(this.props.value)}},{key:"componentWillUnmount",value:function(){this.hideTimeout&&clearTimeout(this.hideTimeout),this.touchUIMask&&(this.disableModality(),this.touchUIMask=null),this.tooltip&&(this.tooltip.destroy(),this.tooltip=null),this.unbindDocumentClickListener(),this.unbindDocumentResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),a.ZIndexUtils.clear(this.overlayRef.current)}},{key:"renderTooltip",value:function(){this.tooltip=o.tip({target:this.inputRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"isVisible",value:function(){return this.props.onVisibleChange?this.props.visible:this.state.overlayVisible}},{key:"isOptionChanged",value:function(e){var t=this;return["dateFormat","hourFormat","timeOnly","showSeconds","showMillisec"].some((function(n){return e[n]!==t.props[n]}))}},{key:"getDateFormat",value:function(){return this.props.dateFormat||u.localeOption("dateFormat",this.props.locale)}},{key:"onInputFocus",value:function(e){var t=this;this.ignoreFocusFunctionality?this.setState({focused:!0},(function(){t.ignoreFocusFunctionality=!1})):(e.persist(),this.props.showOnFocus&&!this.isVisible()&&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),t.props.keepInvalid||t.updateInputfield(t.props.value)}))}},{key:"onInputKeyDown",value:function(e){switch(this.isKeydown=!0,e.which){case 27:this.hideOverlay();break;case 9:this.isVisible()&&this.trapFocus(e),this.props.touchUI&&this.disableModality()}}},{key:"onUserInput",value:function(e){this.isKeydown&&(this.isKeydown=!1,this.updateValueOnInput(e,e.target.value),this.props.onInput&&this.props.onInput(e))}},{key:"updateValueOnInput",value:function(e,t){try{var n=this.parseValueFromString(t);this.isValidSelection(n)&&(this.updateModel(e,n),this.updateViewDate(e,n.length?n[0]:n))}catch(n){this.updateModel(e,this.props.keepInvalid?t:null)}}},{key:"reFocusInputField",value:function(){!this.props.inline&&this.inputRef.current&&(this.ignoreFocusFunctionality=!0,this.inputRef.current.focus())}},{key:"isValidSelection",value:function(e){var t=this,n=!0;return this.isSingleSelection()?this.isSelectable(e.getDate(),e.getMonth(),e.getFullYear(),!1)&&this.isSelectableTime(e)||(n=!1):e.every((function(e){return t.isSelectable(e.getDate(),e.getMonth(),e.getFullYear(),!1)&&t.isSelectableTime(e)}))&&this.isRangeSelection()&&(n=e.length>1&&e[1]>e[0]),n}},{key:"onButtonClick",value:function(){this.isVisible()?this.hideOverlay():this.showOverlay()}},{key:"onPrevButtonClick",value:function(e){this.navigation={backward:!0,button:!0},this.navBackward(e)}},{key:"onNextButtonClick",value:function(e){this.navigation={backward:!1,button:!0},this.navForward(e)}},{key:"onContainerButtonKeydown",value:function(e){switch(e.which){case 9:this.trapFocus(e);break;case 27:this.hideOverlay(null,this.reFocusInputField),e.preventDefault()}}},{key:"trapFocus",value:function(e){e.preventDefault();var t=a.DomHandler.getFocusableElements(this.overlayRef.current);if(t&&t.length>0)if(document.activeElement){var n=t.indexOf(document.activeElement);e.shiftKey?-1===n||0===n?t[t.length-1].focus():t[n-1].focus():-1===n||n===t.length-1?t[0].focus():t[n+1].focus()}else t[0].focus()}},{key:"updateFocus",value:function(){var e;if(this.navigation){if(this.navigation.button)this.initFocusableCell(),this.navigation.backward?a.DomHandler.findSingle(this.overlayRef.current,".p-datepicker-prev").focus():a.DomHandler.findSingle(this.overlayRef.current,".p-datepicker-next").focus();else{if(this.navigation.backward){var t=a.DomHandler.find(this.overlayRef.current,".p-datepicker-calendar td span:not(.p-disabled)");e=t[t.length-1]}else e=a.DomHandler.findSingle(this.overlayRef.current,".p-datepicker-calendar td span:not(.p-disabled)");e&&(e.tabIndex="0",e.focus())}this.navigation=null}else this.initFocusableCell()}},{key:"initFocusableCell",value:function(){var e;if("month"===this.view){var t=a.DomHandler.find(this.overlayRef.current,".p-monthpicker .p-monthpicker-month"),n=a.DomHandler.findSingle(this.overlayRef.current,".p-monthpicker .p-monthpicker-month.p-highlight");t.forEach((function(e){return e.tabIndex=-1})),e=n||t[0]}else if(!(e=a.DomHandler.findSingle(this.overlayRef.current,"span.p-highlight"))){var i=a.DomHandler.findSingle(this.overlayRef.current,"td.p-datepicker-today span:not(.p-disabled)");e=i||a.DomHandler.findSingle(this.overlayRef.current,".p-datepicker-calendar td span:not(.p-disabled)")}e&&(e.tabIndex="0")}},{key:"navBackward",value:function(e){if(this.props.disabled)e.preventDefault();else{var t=new Date(this.getViewDate().getTime());if(t.setDate(1),"date"===this.props.view)0===t.getMonth()?(t.setMonth(11),t.setFullYear(t.getFullYear()-1)):t.setMonth(t.getMonth()-1);else if("month"===this.props.view){var n=t.getFullYear()-1;if(this.props.yearNavigator){var i=parseInt(this.props.yearRange.split(":")[0],10);n<i&&(n=i)}t.setFullYear(n)}this.updateViewDate(e,t),e.preventDefault()}}},{key:"navForward",value:function(e){if(this.props.disabled)e.preventDefault();else{var t=new Date(this.getViewDate().getTime());if(t.setDate(1),"date"===this.props.view)11===t.getMonth()?(t.setMonth(0),t.setFullYear(t.getFullYear()+1)):t.setMonth(t.getMonth()+1);else if("month"===this.props.view){var n=t.getFullYear()+1;if(this.props.yearNavigator){var i=parseInt(this.props.yearRange.split(":")[1],10);n>i&&(n=i)}t.setFullYear(n)}this.updateViewDate(e,t),e.preventDefault()}}},{key:"onMonthDropdownChange",value:function(e,t){var n=this.getViewDate(),i=new Date(n.getTime());i.setMonth(parseInt(t,10)),this.updateViewDate(e,i)}},{key:"onYearDropdownChange",value:function(e,t){var n=this.getViewDate(),i=new Date(n.getTime());i.setFullYear(parseInt(t,10)),this.updateViewDate(e,i)}},{key:"onTodayButtonClick",value:function(e){var t=new Date,n={day:t.getDate(),month:t.getMonth(),year:t.getFullYear(),today:!0,selectable:!0},i={hours:t.getHours(),minutes:t.getMinutes(),seconds:t.getSeconds(),milliseconds:t.getMilliseconds()};this.updateViewDate(e,t),this.onDateSelect(e,n,i),this.props.onTodayButtonClick&&this.props.onTodayButtonClick(e)}},{key:"onClearButtonClick",value:function(e){this.updateModel(e,null),this.updateInputfield(null),this.hideOverlay(null,this.reFocusInputField),this.props.onClearButtonClick&&this.props.onClearButtonClick(e)}},{key:"onPanelClick",value:function(e){this.props.inline||p.OverlayService.emit("overlay-click",{originalEvent:e,target:this.container})}},{key:"onPanelMouseUp",value:function(e){this.onPanelClick(e)}},{key:"onTimePickerElementMouseDown",value:function(e,t,n){this.props.disabled||(this.repeat(e,null,t,n),e.preventDefault())}},{key:"onTimePickerElementMouseUp",value:function(){this.props.disabled||this.clearTimePickerTimer()}},{key:"onTimePickerElementMouseLeave",value:function(){this.props.disabled||this.clearTimePickerTimer()}},{key:"repeat",value:function(e,t,n,i){var r=this;e.persist();var s=t||500;switch(this.clearTimePickerTimer(),this.timePickerTimer=setTimeout((function(){r.repeat(e,100,n,i)}),s),n){case 0:1===i?this.incrementHour(e):this.decrementHour(e);break;case 1:1===i?this.incrementMinute(e):this.decrementMinute(e);break;case 2:1===i?this.incrementSecond(e):this.decrementSecond(e);break;case 3:1===i?this.incrementMilliSecond(e):this.decrementMilliSecond(e)}}},{key:"clearTimePickerTimer",value:function(){this.timePickerTimer&&clearTimeout(this.timePickerTimer)}},{key:"incrementHour",value:function(e){var t=this.getCurrentDateTime(),n=t.getHours()+this.props.stepHour;this.validateHour(n=n>=24?n-24:n,t)&&(this.props.maxDate&&this.props.maxDate.toDateString()===t.toDateString()&&this.props.maxDate.getHours()===n&&(this.props.maxDate.getMinutes()<t.getMinutes()||this.props.maxDate.getMinutes()===t.getMinutes())?this.props.maxDate.getSeconds()<t.getSeconds()?this.props.maxDate.getMilliseconds()<t.getMilliseconds()?this.updateTime(e,n,this.props.maxDate.getMinutes(),this.props.maxDate.getSeconds(),this.props.maxDate.getMilliseconds()):this.updateTime(e,n,this.props.maxDate.getMinutes(),this.props.maxDate.getSeconds(),t.getMilliseconds()):this.updateTime(e,n,this.props.maxDate.getMinutes(),t.getSeconds(),t.getMilliseconds()):this.updateTime(e,n,t.getMinutes(),t.getSeconds(),t.getMilliseconds())),e.preventDefault()}},{key:"decrementHour",value:function(e){var t=this.getCurrentDateTime(),n=t.getHours()-this.props.stepHour;this.validateHour(n=n<0?n+24:n,t)&&(this.props.minDate&&this.props.minDate.toDateString()===t.toDateString()&&this.props.minDate.getHours()===n&&(this.props.minDate.getMinutes()>t.getMinutes()||this.props.minDate.getMinutes()===t.getMinutes())?this.props.minDate.getSeconds()>t.getSeconds()?this.props.minDate.getMilliseconds()>t.getMilliseconds()?this.updateTime(e,n,this.props.minDate.getMinutes(),this.props.minDate.getSeconds(),this.props.minDate.getMilliseconds()):this.updateTime(e,n,this.props.minDate.getMinutes(),this.props.minDate.getSeconds(),t.getMilliseconds()):this.updateTime(e,n,this.props.minDate.getMinutes(),t.getSeconds(),t.getMilliseconds()):this.updateTime(e,n,t.getMinutes(),t.getSeconds(),t.getMilliseconds())),e.preventDefault()}},{key:"incrementMinute",value:function(e){var t=this.getCurrentDateTime(),n=t.getMinutes()+this.props.stepMinute;this.validateMinute(n=n>59?n-60:n,t)&&(this.props.maxDate&&this.props.maxDate.toDateString()===t.toDateString()&&this.props.maxDate.getMinutes()===n&&this.props.maxDate.getSeconds()<t.getSeconds()?this.props.maxDate.getMilliseconds()<t.getMilliseconds()?this.updateTime(e,t.getHours(),n,this.props.maxDate.getSeconds(),this.props.maxDate.getMilliseconds()):this.updateTime(e,t.getHours(),n,this.props.maxDate.getSeconds(),t.getMilliseconds()):this.updateTime(e,t.getHours(),n,t.getSeconds(),t.getMilliseconds())),e.preventDefault()}},{key:"decrementMinute",value:function(e){var t=this.getCurrentDateTime(),n=t.getMinutes()-this.props.stepMinute;this.validateMinute(n=n<0?n+60:n,t)&&(this.props.minDate&&this.props.minDate.toDateString()===t.toDateString()&&this.props.minDate.getMinutes()===n&&this.props.minDate.getSeconds()>t.getSeconds()?this.props.minDate.getMilliseconds()>t.getMilliseconds()?this.updateTime(e,t.getHours(),n,this.props.minDate.getSeconds(),this.props.minDate.getMilliseconds()):this.updateTime(e,t.getHours(),n,this.props.minDate.getSeconds(),t.getMilliseconds()):this.updateTime(e,t.getHours(),n,t.getSeconds(),t.getMilliseconds())),e.preventDefault()}},{key:"incrementSecond",value:function(e){var t=this.getCurrentDateTime(),n=t.getSeconds()+this.props.stepSecond;this.validateSecond(n=n>59?n-60:n,t)&&(this.props.maxDate&&this.props.maxDate.toDateString()===t.toDateString()&&this.props.maxDate.getSeconds()===n&&this.props.maxDate.getMilliseconds()<t.getMilliseconds()?this.updateTime(e,t.getHours(),t.getMinutes(),n,this.props.maxDate.getMilliseconds()):this.updateTime(e,t.getHours(),t.getMinutes(),n,t.getMilliseconds())),e.preventDefault()}},{key:"decrementSecond",value:function(e){var t=this.getCurrentDateTime(),n=t.getSeconds()-this.props.stepSecond;this.validateSecond(n=n<0?n+60:n,t)&&(this.props.minDate&&this.props.minDate.toDateString()===t.toDateString()&&this.props.minDate.getSeconds()===n&&this.props.minDate.getMilliseconds()>t.getMilliseconds()?this.updateTime(e,t.getHours(),t.getMinutes(),n,this.props.minDate.getMilliseconds()):this.updateTime(e,t.getHours(),t.getMinutes(),n,t.getMilliseconds())),e.preventDefault()}},{key:"incrementMilliSecond",value:function(e){var t=this.getCurrentDateTime(),n=t.getMilliseconds()+this.props.stepMillisec;this.validateMillisecond(n=n>999?n-1e3:n,t)&&this.updateTime(e,t.getHours(),t.getMinutes(),t.getSeconds(),n),e.preventDefault()}},{key:"decrementMilliSecond",value:function(e){var t=this.getCurrentDateTime(),n=t.getMilliseconds()-this.props.stepMillisec;this.validateMillisecond(n=n<0?n+999:n,t)&&this.updateTime(e,t.getHours(),t.getMinutes(),t.getSeconds(),n),e.preventDefault()}},{key:"toggleAmPm",value:function(e){var t=this.getCurrentDateTime(),n=t.getHours();this.updateTime(e,n>=12?n-12:n+12,t.getMinutes(),t.getSeconds(),t.getMilliseconds()),e.preventDefault()}},{key:"getViewDate",value:function(e){var t=this.props.value,n=e||(this.props.onViewDateChange?this.props.viewDate:this.state.viewDate);return Array.isArray(t)&&(t=t[0]),n&&this.isValidDate(n)?n:t&&this.isValidDate(t)?t:new Date}},{key:"getCurrentDateTime",value:function(){if(this.isSingleSelection())return this.props.value&&this.props.value instanceof Date?this.props.value:this.getViewDate();if(this.isMultipleSelection()){if(this.props.value&&this.props.value.length)return this.props.value[this.props.value.length-1]}else if(this.isRangeSelection()){if(this.props.value&&this.props.value.length)return this.props.value[1]||this.props.value[0]}return new Date}},{key:"isValidDate",value:function(e){return e instanceof Date&&!isNaN(e)}},{key:"validateHour",value:function(e,t){var n=!0,i=t?t.toDateString():null;return this.props.minDate&&i&&this.props.minDate.toDateString()===i&&this.props.minDate.getHours()>e&&(n=!1),this.props.maxDate&&i&&this.props.maxDate.toDateString()===i&&this.props.maxDate.getHours()<e&&(n=!1),n}},{key:"validateMinute",value:function(e,t){var n=!0,i=t?t.toDateString():null;return this.props.minDate&&i&&this.props.minDate.toDateString()===i&&t.getHours()===this.props.minDate.getHours()&&this.props.minDate.getMinutes()>e&&(n=!1),this.props.maxDate&&i&&this.props.maxDate.toDateString()===i&&t.getHours()===this.props.maxDate.getHours()&&this.props.maxDate.getMinutes()<e&&(n=!1),n}},{key:"validateSecond",value:function(e,t){var n=!0,i=t?t.toDateString():null;return this.props.minDate&&i&&this.props.minDate.toDateString()===i&&t.getHours()===this.props.minDate.getHours()&&t.getMinutes()===this.props.minDate.getMinutes()&&this.props.minDate.getSeconds()>e&&(n=!1),this.props.maxDate&&i&&this.props.maxDate.toDateString()===i&&t.getHours()===this.props.maxDate.getHours()&&t.getMinutes()===this.props.maxDate.getMinutes()&&this.props.maxDate.getSeconds()<e&&(n=!1),n}},{key:"validateMillisecond",value:function(e,t){var n=!0,i=t?t.toDateString():null;return this.props.minDate&&i&&this.props.minDate.toDateString()===i&&t.getHours()===this.props.minDate.getHours()&&t.getSeconds()===this.props.minDate.getSeconds()&&t.getMinutes()===this.props.minDate.getMinutes()&&this.props.minDate.getMilliseconds()>e&&(n=!1),this.props.maxDate&&i&&this.props.maxDate.toDateString()===i&&t.getHours()===this.props.maxDate.getHours()&&t.getSeconds()===this.props.maxDate.getSeconds()&&t.getMinutes()===this.props.maxDate.getMinutes()&&this.props.maxDate.getMilliseconds()<e&&(n=!1),n}},{key:"validateDate",value:function(e){if(this.props.yearNavigator){var t=e.getFullYear(),n=this.props.yearRange?parseInt(this.props.yearRange.split(":")[0],10):null,i=this.props.yearRange?parseInt(this.props.yearRange.split(":")[1],10):null,r=this.props.minDate&&null!=n?Math.max(this.props.minDate.getFullYear(),n):this.props.minDate||n,s=this.props.maxDate&&null!=i?Math.min(this.props.maxDate.getFullYear(),i):this.props.maxDate||i;r&&r>t&&(t=r),s&&s<t&&(t=s),e.setFullYear(t)}if(this.props.monthNavigator&&"month"!==this.props.view){var a=e.getMonth(),o=parseInt(this.isInMinYear(e)&&Math.max(this.props.minDate.getMonth(),a).toString()||this.isInMaxYear(e)&&Math.min(this.props.maxDate.getMonth(),a).toString()||a);e.setMonth(o)}}},{key:"updateTime",value:function(e,t,n,i,r){var s=this.getCurrentDateTime();if(s.setHours(t),s.setMinutes(n),s.setSeconds(i),s.setMilliseconds(r),this.isMultipleSelection())if(this.props.value&&this.props.value.length){var a=M(this.props.value);a[a.length-1]=s,s=a}else s=[s];else if(this.isRangeSelection()){if(this.props.value&&this.props.value.length)s=this.props.value[1]?[this.props.value[0],s]:[s,null];else s=[s,null]}this.updateModel(e,s),this.props.onSelect&&this.props.onSelect({originalEvent:e,value:s}),this.updateInputfield(s)}},{key:"updateViewDate",value:function(e,t){this.validateDate(t),this.props.onViewDateChange?this.props.onViewDateChange({originalEvent:e,value:t}):(this.viewStateChanged=!0,this.setState({viewDate:t}))}},{key:"onDateCellKeydown",value:function(e,t,n){var i=e.currentTarget,r=i.parentElement;switch(e.which){case 40:i.tabIndex="-1";var s=a.DomHandler.index(r),o=r.parentElement.nextElementSibling;if(o)a.DomHandler.hasClass(o.children[s].children[0],"p-disabled")?(this.navigation={backward:!1},this.navForward(e)):(o.children[s].children[0].tabIndex="0",o.children[s].children[0].focus());else this.navigation={backward:!1},this.navForward(e);e.preventDefault();break;case 38:i.tabIndex="-1";var l=a.DomHandler.index(r),u=r.parentElement.previousElementSibling;if(u){var p=u.children[l].children[0];a.DomHandler.hasClass(p,"p-disabled")?(this.navigation={backward:!0},this.navBackward(e)):(p.tabIndex="0",p.focus())}else this.navigation={backward:!0},this.navBackward(e);e.preventDefault();break;case 37:i.tabIndex="-1";var c=r.previousElementSibling;if(c){var h=c.children[0];a.DomHandler.hasClass(h,"p-disabled")?this.navigateToMonth(!0,n,e):(h.tabIndex="0",h.focus())}else this.navigateToMonth(!0,n,e);e.preventDefault();break;case 39:i.tabIndex="-1";var d=r.nextElementSibling;if(d){var m=d.children[0];a.DomHandler.hasClass(m,"p-disabled")?this.navigateToMonth(!1,n,e):(m.tabIndex="0",m.focus())}else this.navigateToMonth(!1,n,e);e.preventDefault();break;case 13:this.onDateSelect(e,t),e.preventDefault();break;case 27:this.hideOverlay(null,this.reFocusInputField),e.preventDefault();break;case 9:this.trapFocus(e)}}},{key:"navigateToMonth",value:function(e,t,n){if(e)if(1===this.props.numberOfMonths||0===t)this.navigation={backward:!0},this.navBackward(n);else{var i=a.DomHandler.find(this.overlayRef.current.children[t-1],".p-datepicker-calendar td span:not(.p-disabled)"),r=i[i.length-1];r.tabIndex="0",r.focus()}else if(1===this.props.numberOfMonths||t===this.props.numberOfMonths-1)this.navigation={backward:!1},this.navForward(n);else{var s=a.DomHandler.findSingle(this.overlayRef.current.children[t+1],".p-datepicker-calendar td span:not(.p-disabled)");s.tabIndex="0",s.focus()}}},{key:"onMonthCellKeydown",value:function(e,t){var n=e.currentTarget;switch(e.which){case 38:case 40:n.tabIndex="-1";var i=n.parentElement.children,r=a.DomHandler.index(n),s=i[40===e.which?r+3:r-3];s&&(s.tabIndex="0",s.focus()),e.preventDefault();break;case 37:n.tabIndex="-1";var o=n.previousElementSibling;o&&(o.tabIndex="0",o.focus()),e.preventDefault();break;case 39:n.tabIndex="-1";var l=n.nextElementSibling;l&&(l.tabIndex="0",l.focus()),e.preventDefault();break;case 13:this.onMonthSelect(e,t),e.preventDefault();break;case 27:this.hideOverlay(null,this.reFocusInputField),e.preventDefault();break;case 9:this.trapFocus(e)}}},{key:"onDateSelect",value:function(e,t,n){var i=this;if(!this.props.disabled&&t.selectable){if(a.DomHandler.find(this.overlayRef.current,".p-datepicker-calendar td span:not(.p-disabled)").forEach((function(e){return e.tabIndex=-1})),e.currentTarget.focus(),this.isMultipleSelection())if(this.isSelected(t)){var r=this.props.value.filter((function(e,n){return!i.isDateEquals(e,t)}));this.updateModel(e,r),this.updateInputfield(r)}else(!this.props.maxDateCount||!this.props.value||this.props.maxDateCount>this.props.value.length)&&this.selectDate(e,t,n);else this.selectDate(e,t,n);this.props.inline||!this.isSingleSelection()||this.props.showTime&&!this.props.hideOnDateTimeSelect||(setTimeout((function(){i.hideOverlay("dateselect")}),100),this.touchUIMask&&this.disableModality()),e.preventDefault()}else e.preventDefault()}},{key:"selectTime",value:function(e,t){if(this.props.showTime){var n,i,r,s;if(t)n=t.hours,i=t.minutes,r=t.seconds,s=t.milliseconds;else{var a=this.getCurrentDateTime(),o=[a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()];n=o[0],i=o[1],r=o[2],s=o[3]}e.setHours(n),e.setMinutes(i),e.setSeconds(r),e.setMilliseconds(s)}}},{key:"selectDate",value:function(e,t,n){var i=new Date(t.year,t.month,t.day);this.selectTime(i,n),this.props.minDate&&this.props.minDate>i&&(i=this.props.minDate),this.props.maxDate&&this.props.maxDate<i&&(i=this.props.maxDate);var r=i;if(this.isSingleSelection())this.updateModel(e,i);else if(this.isMultipleSelection())r=this.props.value?[].concat(M(this.props.value),[i]):[i],this.updateModel(e,r);else if(this.isRangeSelection())if(this.props.value&&this.props.value.length){var s=this.props.value[0],a=this.props.value[1];a?(s=i,a=null):i.getTime()>=s.getTime()?a=i:(a=s,s=i),this.updateModel(e,r=[s,a])}else this.updateModel(e,r=[i,null]);this.props.onSelect&&this.props.onSelect({originalEvent:e,value:i}),this.updateInputfield(r)}},{key:"onMonthSelect",value:function(e,t){this.onDateSelect(e,{year:this.getViewDate().getFullYear(),month:t,day:1,selectable:!0}),e.preventDefault()}},{key:"updateModel",value:function(e,t){if(this.props.onChange){var n=t&&t instanceof Date?new Date(t.getTime()):t;this.viewStateChanged=!0,this.props.onChange({originalEvent:e,value:n,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:n}})}}},{key:"showOverlay",value:function(e){var t=this;this.props.onVisibleChange?this.props.onVisibleChange({visible:!0,type:e}):this.setState({overlayVisible:!0},(function(){t.overlayEventListener=function(e){t.isOutsideClicked(e.target)||(t.isOverlayClicked=!0)},p.OverlayService.on("overlay-click",t.overlayEventListener)}))}},{key:"hideOverlay",value:function(e,t){var n=this,i=function(){n.viewStateChanged=!1,n.ignoreFocusFunctionality=!1,n.isOverlayClicked=!1,t&&t(),p.OverlayService.off("overlay-click",n.overlayEventListener),n.overlayEventListener=null};this.props.onVisibleChange?this.props.onVisibleChange({visible:!1,type:e,callback:i}):this.setState({overlayVisible:!1},i)}},{key:"onOverlayEnter",value:function(){if(this.props.autoZIndex){var e=this.props.touchUI?"modal":"overlay";a.ZIndexUtils.set(e,this.overlayRef.current,d.default.autoZIndex,this.props.baseZIndex||d.default.zIndex[e])}this.alignOverlay()}},{key:"onOverlayEntered",value:function(){this.bindDocumentClickListener(),this.bindDocumentResizeListener(),this.bindScrollListener(),this.props.onShow&&this.props.onShow()}},{key:"onOverlayExit",value:function(){this.unbindDocumentClickListener(),this.unbindDocumentResizeListener(),this.unbindScrollListener()}},{key:"onOverlayExited",value:function(){a.ZIndexUtils.clear(this.overlayRef.current),this.props.onHide&&this.props.onHide()}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){!e.isOverlayClicked&&e.isVisible()&&e.isOutsideClicked(t.target)&&e.hideOverlay("outside"),e.isOverlayClicked=!1},document.addEventListener("click",this.documentClickListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"bindDocumentResizeListener",value:function(){this.documentResizeListener||this.props.touchUI||(this.documentResizeListener=this.onWindowResize.bind(this),window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentResizeListener",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new a.ConnectedOverlayScrollHandler(this.container,(function(){e.isVisible()&&e.hideOverlay()}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"isOutsideClicked",value:function(e){return this.container&&!(this.container.isSameNode(e)||this.isNavIconClicked(e)||this.container.contains(e)||this.overlayRef&&this.overlayRef.current.contains(e))}},{key:"isNavIconClicked",value:function(e){return a.DomHandler.hasClass(e,"p-datepicker-prev")||a.DomHandler.hasClass(e,"p-datepicker-prev-icon")||a.DomHandler.hasClass(e,"p-datepicker-next")||a.DomHandler.hasClass(e,"p-datepicker-next-icon")}},{key:"onWindowResize",value:function(){this.isVisible()&&!a.DomHandler.isAndroid()&&this.hideOverlay()}},{key:"alignOverlay",value:function(){this.props.touchUI?this.enableModality():a.DomHandler.alignOverlay(this.overlayRef.current,this.inputRef.current.parentElement,this.props.appendTo||d.default.appendTo)}},{key:"enableModality",value:function(){var e=this;this.touchUIMask||(this.touchUIMask=document.createElement("div"),this.touchUIMask.style.zIndex=String(a.ZIndexUtils.get(this.overlayRef.current)-1),a.DomHandler.addMultipleClasses(this.touchUIMask,"p-component-overlay p-datepicker-mask p-datepicker-mask-scrollblocker p-component-overlay-enter"),this.touchUIMaskClickListener=function(){e.disableModality()},this.touchUIMask.addEventListener("click",this.touchUIMaskClickListener),document.body.appendChild(this.touchUIMask),a.DomHandler.addClass(document.body,"p-overflow-hidden"))}},{key:"disableModality",value:function(){var e=this;this.touchUIMask&&(a.DomHandler.addClass(this.touchUIMask,"p-component-overlay-leave"),this.touchUIMask.addEventListener("animationend",(function(){e.destroyMask()})))}},{key:"destroyMask",value:function(){this.touchUIMask.removeEventListener("click",this.touchUIMaskClickListener),this.touchUIMaskClickListener=null,document.body.removeChild(this.touchUIMask),this.touchUIMask=null;for(var e,t=document.body.children,n=0;n<t.length;n++){if(a.DomHandler.hasClass(t[n],"p-datepicker-mask-scrollblocker")){e=!0;break}}e||a.DomHandler.removeClass(document.body,"p-overflow-hidden")}},{key:"getFirstDayOfMonthIndex",value:function(e,t){var n=new Date;n.setDate(1),n.setMonth(e),n.setFullYear(t);var i=n.getDay()+this.getSundayIndex();return i>=7?i-7:i}},{key:"getDaysCountInMonth",value:function(e,t){return 32-this.daylightSavingAdjust(new Date(t,e,32)).getDate()}},{key:"getDaysCountInPrevMonth",value:function(e,t){var n=this.getPreviousMonthAndYear(e,t);return this.getDaysCountInMonth(n.month,n.year)}},{key:"daylightSavingAdjust",value:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null}},{key:"getPreviousMonthAndYear",value:function(e,t){var n,i;return 0===e?(n=11,i=t-1):(n=e-1,i=t),{month:n,year:i}}},{key:"getNextMonthAndYear",value:function(e,t){var n,i;return 11===e?(n=0,i=t+1):(n=e+1,i=t),{month:n,year:i}}},{key:"getSundayIndex",value:function(){var e=u.localeOption("firstDayOfWeek",this.props.locale);return e>0?7-e:0}},{key:"createWeekDays",value:function(){for(var e=[],t=u.localeOptions(this.props.locale),n=t.firstDayOfWeek,i=t.dayNamesMin,r=0;r<7;r++)e.push(i[n]),n=6===n?0:++n;return e}},{key:"createMonths",value:function(e,t){for(var n=[],i=0;i<this.props.numberOfMonths;i++){var r=e+i,s=t;r>11&&(r=r%11-1,s=t+1),n.push(this.createMonth(r,s))}return n}},{key:"createMonth",value:function(e,t){for(var n=[],i=this.getFirstDayOfMonthIndex(e,t),r=this.getDaysCountInMonth(e,t),s=this.getDaysCountInPrevMonth(e,t),a=1,o=new Date,l=[],u=Math.ceil((r+i)/7),p=0;p<u;p++){var c=[];if(0===p){for(var h=s-i+1;h<=s;h++){var d=this.getPreviousMonthAndYear(e,t);c.push({day:h,month:d.month,year:d.year,otherMonth:!0,today:this.isToday(o,h,d.month,d.year),selectable:this.isSelectable(h,d.month,d.year,!0)})}for(var m=7-c.length,f=0;f<m;f++)c.push({day:a,month:e,year:t,today:this.isToday(o,a,e,t),selectable:this.isSelectable(a,e,t,!1)}),a++}else for(var v=0;v<7;v++){if(a>r){var g=this.getNextMonthAndYear(e,t);c.push({day:a-r,month:g.month,year:g.year,otherMonth:!0,today:this.isToday(o,a-r,g.month,g.year),selectable:this.isSelectable(a-r,g.month,g.year,!0)})}else c.push({day:a,month:e,year:t,today:this.isToday(o,a,e,t),selectable:this.isSelectable(a,e,t,!1)});a++}this.props.showWeek&&l.push(this.getWeekNumber(new Date(c[0].year,c[0].month,c[0].day))),n.push(c)}return{month:e,year:t,dates:n,weekNumbers:l}}},{key:"getWeekNumber",value:function(e){var t=new Date(e.getTime());t.setDate(t.getDate()+4-(t.getDay()||7));var n=t.getTime();return t.setMonth(0),t.setDate(1),Math.floor(Math.round((n-t.getTime())/864e5)/7)+1}},{key:"isSelectable",value:function(e,t,n,i){var r=!0,s=!0,a=!0,o=!0,l=!0;return this.props.minDate&&(this.props.minDate.getFullYear()>n||this.props.minDate.getFullYear()===n&&(this.props.minDate.getMonth()>t||this.props.minDate.getMonth()===t&&this.props.minDate.getDate()>e))&&(r=!1),this.props.maxDate&&(this.props.maxDate.getFullYear()<n||this.props.maxDate.getFullYear()===n&&(this.props.maxDate.getMonth()<t||this.props.maxDate.getMonth()===t&&this.props.maxDate.getDate()<e))&&(s=!1),this.props.disabledDates&&(a=!this.isDateDisabled(e,t,n)),this.props.disabledDays&&(o=!this.isDayDisabled(e,t,n)),!1===this.props.selectOtherMonths&&i&&(l=!1),r&&s&&a&&o&&l}},{key:"isSelectableTime",value:function(e){var t=!0,n=!0;return this.props.minDate&&this.props.minDate.toDateString()===e.toDateString()&&(this.props.minDate.getHours()>e.getHours()||this.props.minDate.getHours()===e.getHours()&&(this.props.minDate.getMinutes()>e.getMinutes()||this.props.minDate.getMinutes()===e.getMinutes()&&(this.props.minDate.getSeconds()>e.getSeconds()||this.props.minDate.getSeconds()===e.getSeconds()&&this.props.minDate.getMilliseconds()>e.getMilliseconds())))&&(t=!1),this.props.maxDate&&this.props.maxDate.toDateString()===e.toDateString()&&(this.props.maxDate.getHours()<e.getHours()||this.props.maxDate.getHours()===e.getHours()&&(this.props.maxDate.getMinutes()<e.getMinutes()||this.props.maxDate.getMinutes()===e.getMinutes()&&(this.props.maxDate.getSeconds()<e.getSeconds()||this.props.maxDate.getSeconds()===e.getSeconds()&&this.props.maxDate.getMilliseconds()<e.getMilliseconds())))&&(n=!1),t&&n}},{key:"isSelected",value:function(e){if(!this.props.value)return!1;if(this.isSingleSelection())return this.isDateEquals(this.props.value,e);if(this.isMultipleSelection()){var t,n=!1,i=P(this.props.value);try{for(i.s();!(t=i.n()).done;){if(n=this.isDateEquals(t.value,e))break}}catch(e){i.e(e)}finally{i.f()}return n}return this.isRangeSelection()?this.props.value[1]?this.isDateEquals(this.props.value[0],e)||this.isDateEquals(this.props.value[1],e)||this.isDateBetween(this.props.value[0],this.props.value[1],e):this.isDateEquals(this.props.value[0],e):void 0}},{key:"isMonthSelected",value:function(e){var t=this.getViewDate();return!!(this.props.value&&this.props.value instanceof Date)&&(1===this.props.value.getDate()&&this.props.value.getMonth()===e&&this.props.value.getFullYear()===t.getFullYear())}},{key:"isDateEquals",value:function(e,t){return!!(e&&e instanceof Date)&&(e.getDate()===t.day&&e.getMonth()===t.month&&e.getFullYear()===t.year)}},{key:"isDateBetween",value:function(e,t,n){if(e&&t){var i=new Date(n.year,n.month,n.day);return e.getTime()<=i.getTime()&&t.getTime()>=i.getTime()}return!1}},{key:"isSingleSelection",value:function(){return"single"===this.props.selectionMode}},{key:"isRangeSelection",value:function(){return"range"===this.props.selectionMode}},{key:"isMultipleSelection",value:function(){return"multiple"===this.props.selectionMode}},{key:"isToday",value:function(e,t,n,i){return e.getDate()===t&&e.getMonth()===n&&e.getFullYear()===i}},{key:"isDateDisabled",value:function(e,t,n){if(this.props.disabledDates)for(var i=0;i<this.props.disabledDates.length;i++){var r=this.props.disabledDates[i];if(r.getFullYear()===n&&r.getMonth()===t&&r.getDate()===e)return!0}return!1}},{key:"isDayDisabled",value:function(e,t,n){if(this.props.disabledDays){var i=new Date(n,t,e).getDay();return-1!==this.props.disabledDays.indexOf(i)}return!1}},{key:"updateInputfield",value:function(e){if(this.inputRef&&this.inputRef.current){var t="";if(e)try{if(this.isSingleSelection())t=this.isValidDate(e)?this.formatDateTime(e):"";else if(this.isMultipleSelection())for(var n=0;n<e.length;n++){var i=e[n];t+=this.isValidDate(i)?this.formatDateTime(i):"",n!==e.length-1&&(t+=", ")}else if(this.isRangeSelection()&&e&&e.length){var r=e[0],s=e[1];t=this.isValidDate(r)?this.formatDateTime(r):"",s&&(t+=this.isValidDate(s)?" - "+this.formatDateTime(s):"")}}catch(n){t=e}this.inputRef.current.value=t}}},{key:"formatDateTime",value:function(e){var t=null;return e&&(this.props.timeOnly?t=this.formatTime(e):(t=this.formatDate(e,this.getDateFormat()),this.props.showTime&&(t+=" "+this.formatTime(e)))),t}},{key:"formatDate",value:function(e,t){if(!e)return"";var n,i=function(e){var i=n+1<t.length&&t.charAt(n+1)===e;return i&&n++,i},r=function(e,t,n){var r=""+t;if(i(e))for(;r.length<n;)r="0"+r;return r},s=function(e,t,n,r){return i(e)?r[t]:n[t]},a="",o=!1,l=u.localeOptions(this.props.locale),p=l.dayNamesShort,c=l.dayNames,h=l.monthNamesShort,d=l.monthNames;if(e)for(n=0;n<t.length;n++)if(o)"'"!==t.charAt(n)||i("'")?a+=t.charAt(n):o=!1;else switch(t.charAt(n)){case"d":a+=r("d",e.getDate(),2);break;case"D":a+=s("D",e.getDay(),p,c);break;case"o":a+=r("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":a+=r("m",e.getMonth()+1,2);break;case"M":a+=s("M",e.getMonth(),h,d);break;case"y":a+=i("y")?e.getFullYear():(e.getFullYear()%100<10?"0":"")+e.getFullYear()%100;break;case"@":a+=e.getTime();break;case"!":a+=1e4*e.getTime()+this.ticksTo1970;break;case"'":i("'")?a+="'":o=!0;break;default:a+=t.charAt(n)}return a}},{key:"formatTime",value:function(e){if(!e)return"";var t="",n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),s=e.getMilliseconds();return"12"===this.props.hourFormat&&n>11&&12!==n&&(n-=12),t+="12"===this.props.hourFormat&&0===n?12:n<10?"0"+n:n,t+=":",t+=i<10?"0"+i:i,this.props.showSeconds&&(t+=":",t+=r<10?"0"+r:r),this.props.showMillisec&&(t+=".",t+=s<100?(s<10?"00":"0")+s:s),"12"===this.props.hourFormat&&(t+=e.getHours()>11?" PM":" AM"),t}},{key:"parseValueFromString",value:function(e){if(!e||0===e.trim().length)return null;var t;if(this.isSingleSelection())t=this.parseDateTime(e);else if(this.isMultipleSelection()){t=[];var n,i=P(e.split(","));try{for(i.s();!(n=i.n()).done;){t.push(this.parseDateTime(n.value.trim()))}}catch(e){i.e(e)}finally{i.f()}}else if(this.isRangeSelection()){var r=e.split(" - ");t=[];for(var s=0;s<r.length;s++)t[s]=this.parseDateTime(r[s].trim())}return t}},{key:"parseDateTime",value:function(e){var t,n=e.split(" ");return this.props.timeOnly?(t=new Date,this.populateTime(t,n[0],n[1])):this.props.showTime?(t=this.parseDate(n[0],this.getDateFormat()),this.populateTime(t,n[1],n[2])):t=this.parseDate(e,this.getDateFormat()),t}},{key:"populateTime",value:function(e,t,n){if("12"===this.props.hourFormat&&"PM"!==n&&"AM"!==n)throw new Error("Invalid Time");var i=this.parseTime(t,n);e.setHours(i.hour),e.setMinutes(i.minute),e.setSeconds(i.second),e.setMilliseconds(i.millisecond)}},{key:"parseTime",value:function(e,t){var n=(e=this.props.showMillisec?e.replace(".",":"):e).split(":"),i=this.props.showSeconds?3:2;if(n.length!==(i=this.props.showMillisec?i+1:i)||2!==n[0].length||2!==n[1].length||this.props.showSeconds&&2!==n[2].length||this.props.showMillisec&&3!==n[3].length)throw new Error("Invalid time");var r=parseInt(n[0],10),s=parseInt(n[1],10),a=this.props.showSeconds?parseInt(n[2],10):null,o=this.props.showMillisec?parseInt(n[3],10):null;if(isNaN(r)||isNaN(s)||r>23||s>59||"12"===this.props.hourFormat&&r>12||this.props.showSeconds&&(isNaN(a)||a>59)||this.props.showMillisec&&(isNaN(a)||a>1e3))throw new Error("Invalid time");return"12"===this.props.hourFormat&&12!==r&&"PM"===t&&(r+=12),{hour:r,minute:s,second:a,millisecond:o}}},{key:"parseDate",value:function(e,t){if(null==t||null==e)throw new Error("Invalid arguments");if(""===(e="object"===f(e)?e.toString():e+""))return null;var n,i,r,s,a=0,o="string"!=typeof this.props.shortYearCutoff?this.props.shortYearCutoff:(new Date).getFullYear()%100+parseInt(this.props.shortYearCutoff,10),l=-1,p=-1,c=-1,h=-1,d=!1,m=function(e){var i=n+1<t.length&&t.charAt(n+1)===e;return i&&n++,i},v=function(t){var n=m(t),i="@"===t?14:"!"===t?20:"y"===t&&n?4:"o"===t?3:2,r=new RegExp("^\\d{"+("y"===t?i:1)+","+i+"}"),s=e.substring(a).match(r);if(!s)throw new Error("Missing number at position "+a);return a+=s[0].length,parseInt(s[0],10)},g=function(t,n,i){for(var r=-1,s=m(t)?i:n,o=[],l=0;l<s.length;l++)o.push([l,s[l]]);o.sort((function(e,t){return-(e[1].length-t[1].length)}));for(var u=0;u<o.length;u++){var p=o[u][1];if(e.substr(a,p.length).toLowerCase()===p.toLowerCase()){r=o[u][0],a+=p.length;break}}if(-1!==r)return r+1;throw new Error("Unknown name at position "+a)},y=function(){if(e.charAt(a)!==t.charAt(n))throw new Error("Unexpected literal at position "+a);a++};"month"===this.props.view&&(c=1);var D=u.localeOptions(this.props.locale),k=D.dayNamesShort,M=D.dayNames,b=D.monthNamesShort,w=D.monthNames;for(n=0;n<t.length;n++)if(d)"'"!==t.charAt(n)||m("'")?y():d=!1;else switch(t.charAt(n)){case"d":c=v("d");break;case"D":g("D",k,M);break;case"o":h=v("o");break;case"m":p=v("m");break;case"M":p=g("M",b,w);break;case"y":l=v("y");break;case"@":l=(s=new Date(v("@"))).getFullYear(),p=s.getMonth()+1,c=s.getDate();break;case"!":l=(s=new Date((v("!")-this.ticksTo1970)/1e4)).getFullYear(),p=s.getMonth()+1,c=s.getDate();break;case"'":m("'")?y():d=!0;break;default:y()}if(a<e.length&&(r=e.substr(a),!/^\s+/.test(r)))throw new Error("Extra/unparsed characters found in date: "+r);if(-1===l?l=(new Date).getFullYear():l<100&&(l+=(new Date).getFullYear()-(new Date).getFullYear()%100+(l<=o?0:-100)),h>-1)for(p=1,c=h;;){if(c<=(i=this.getDaysCountInMonth(l,p-1)))break;p++,c-=i}if((s=this.daylightSavingAdjust(new Date(l,p-1,c))).getFullYear()!==l||s.getMonth()+1!==p||s.getDate()!==c)throw new Error("Invalid date");return s}},{key:"renderBackwardNavigator",value:function(e){var t=this;return h.default.createElement("button",m({type:"button",className:"p-datepicker-prev p-link"},e?{onClick:this.onPrevButtonClick,onKeyDown:function(e){return t.onContainerButtonKeydown(e)}}:{style:{visibility:"hidden"}}),h.default.createElement("span",{className:"p-datepicker-prev-icon pi pi-chevron-left"}),h.default.createElement(l.Ripple,null))}},{key:"renderForwardNavigator",value:function(e){var t=this;return h.default.createElement("button",m({type:"button",className:"p-datepicker-next p-link"},e?{onClick:this.onNextButtonClick,onKeyDown:function(e){return t.onContainerButtonKeydown(e)}}:{style:{visibility:"hidden"}}),h.default.createElement("span",{className:"p-datepicker-next-icon pi pi-chevron-right"}),h.default.createElement(l.Ripple,null))}},{key:"isInMinYear",value:function(e){return this.props.minDate&&this.props.minDate.getFullYear()===e.getFullYear()}},{key:"isInMaxYear",value:function(e){return this.props.maxDate&&this.props.maxDate.getFullYear()===e.getFullYear()}},{key:"renderTitleMonthElement",value:function(e){var t=this,n=u.localeOption("monthNames",this.props.locale);if(this.props.monthNavigator&&"month"!==this.props.view){var i=this.getViewDate(),r=i.getMonth(),s=n.map((function(e,n){return(!t.isInMinYear(i)||n>=t.props.minDate.getMonth())&&(!t.isInMaxYear(i)||n<=t.props.maxDate.getMonth())?{label:e,value:n,index:n}:null})).filter((function(e){return!!e})),o=s.map((function(e){return e.label})),l=h.default.createElement("select",{className:"p-datepicker-month",onChange:function(e){return t.onMonthDropdownChange(e,e.target.value)},value:r},s.map((function(e){return h.default.createElement("option",{key:e.label,value:e.value},e.label)})));return this.props.monthNavigatorTemplate?a.ObjectUtils.getJSXElement(this.props.monthNavigatorTemplate,{onChange:this.onMonthDropdownChange,className:"p-datepicker-month",value:r,names:o,options:s,element:l,props:this.props}):l}return h.default.createElement("span",{className:"p-datepicker-month"},n[e])}},{key:"renderTitleYearElement",value:function(e){var t=this;if(this.props.yearNavigator){for(var n=[],i=this.props.yearRange.split(":"),r=parseInt(i[0],10),s=parseInt(i[1],10),o=r;o<=s;o++)n.push(o);var l=this.getViewDate().getFullYear(),u=n.filter((function(e){return!(t.props.minDate&&t.props.minDate.getFullYear()>e||t.props.maxDate&&t.props.maxDate.getFullYear()<e)})),p=h.default.createElement("select",{className:"p-datepicker-year",onChange:function(e){return t.onYearDropdownChange(e,e.target.value)},value:l},u.map((function(e){return h.default.createElement("option",{key:e,value:e},e)})));if(this.props.yearNavigatorTemplate){var c=u.map((function(e,t){return{label:e,value:e,index:t}}));return a.ObjectUtils.getJSXElement(this.props.yearNavigatorTemplate,{onChange:this.onYearDropdownChange,className:"p-datepicker-year",value:l,names:u,options:c,element:p,props:this.props})}return p}return h.default.createElement("span",{className:"p-datepicker-year"},e)}},{key:"renderTitle",value:function(e){var t=this.renderTitleMonthElement(e.month),n=this.renderTitleYearElement(e.year);return h.default.createElement("div",{className:"p-datepicker-title"},t,n)}},{key:"renderDayNames",value:function(e){var t=e.map((function(e,t){return h.default.createElement("th",{key:"".concat(e,"-").concat(t),scope:"col"},h.default.createElement("span",null,e))}));return this.props.showWeek?[h.default.createElement("th",{scope:"col",key:"wn",className:"p-datepicker-weekheader p-disabled"},h.default.createElement("span",null,u.localeOption("weekHeader",this.props.locale)))].concat(M(t)):t}},{key:"renderDateCellContent",value:function(e,t,n){var i=this,r=this.props.dateTemplate?this.props.dateTemplate(e):e.day;return h.default.createElement("span",{className:t,onClick:function(t){return i.onDateSelect(t,e)},onKeyDown:function(t){return i.onDateCellKeydown(t,e,n)}},r,h.default.createElement(l.Ripple,null))}},{key:"renderWeek",value:function(e,t,n){var i=this,r=e.map((function(e){var t=i.isSelected(e),r=a.classNames({"p-datepicker-other-month":e.otherMonth,"p-datepicker-today":e.today}),s=a.classNames({"p-highlight":t,"p-disabled":!e.selectable}),o=e.otherMonth&&!i.props.showOtherMonths?null:i.renderDateCellContent(e,s,n);return h.default.createElement("td",{key:e.day,className:r},o)}));return this.props.showWeek?[h.default.createElement("td",{key:"wn"+t,className:"p-datepicker-weeknumber"},h.default.createElement("span",{className:"p-disabled"},t))].concat(M(r)):r}},{key:"renderDates",value:function(e,t){var n=this;return e.dates.map((function(i,r){return h.default.createElement("tr",{key:r},n.renderWeek(i,e.weekNumbers[r],t))}))}},{key:"renderDateViewGrid",value:function(e,t,n){var i=this.renderDayNames(t),r=this.renderDates(e,n);return h.default.createElement("div",{className:"p-datepicker-calendar-container"},h.default.createElement("table",{className:"p-datepicker-calendar"},h.default.createElement("thead",null,h.default.createElement("tr",null,i)),h.default.createElement("tbody",null,r)))}},{key:"renderMonth",value:function(e,t){var n=this.createWeekDays(),i=this.renderBackwardNavigator(0===t),r=this.renderForwardNavigator(1===this.props.numberOfMonths||t===this.props.numberOfMonths-1),s=this.renderTitle(e),a=this.renderDateViewGrid(e,n,t),o=this.props.headerTemplate?this.props.headerTemplate():null;return h.default.createElement("div",{key:e.month,className:"p-datepicker-group"},h.default.createElement("div",{className:"p-datepicker-header"},o,i,s,r),a)}},{key:"renderMonths",value:function(e){var t=this,n=e.map((function(e,n){return t.renderMonth(e,n)}));return h.default.createElement("div",{className:"p-datepicker-group-container"},n)}},{key:"renderDateView",value:function(){var e=this.getViewDate(),t=this.createMonths(e.getMonth(),e.getFullYear()),n=this.renderMonths(t);return h.default.createElement(h.default.Fragment,null,n)}},{key:"renderMonthViewMonth",value:function(e){var t=this,n=a.classNames("p-monthpicker-month",{"p-highlight":this.isMonthSelected(e)}),i=u.localeOption("monthNamesShort",this.props.locale)[e];return h.default.createElement("span",{key:i,className:n,onClick:function(n){return t.onMonthSelect(n,e)},onKeyDown:function(n){return t.onMonthCellKeydown(n,e)}},i,h.default.createElement(l.Ripple,null))}},{key:"renderMonthViewMonths",value:function(){for(var e=[],t=0;t<=11;t++)e.push(this.renderMonthViewMonth(t));return e}},{key:"renderMonthView",value:function(){var e=this.renderBackwardNavigator(!0),t=this.renderForwardNavigator(!0),n=this.renderTitleYearElement(this.getViewDate().getFullYear()),i=this.renderMonthViewMonths();return h.default.createElement(h.default.Fragment,null,h.default.createElement("div",{className:"p-datepicker-group-container"},h.default.createElement("div",{className:"p-datepicker-group"},h.default.createElement("div",{className:"p-datepicker-header"},e,h.default.createElement("div",{className:"p-datepicker-title"},n),t))),h.default.createElement("div",{className:"p-monthpicker"},i))}},{key:"renderDatePicker",value:function(){if(!this.props.timeOnly)return"date"===this.props.view?this.renderDateView():"month"===this.props.view?this.renderMonthView():null}},{key:"renderHourPicker",value:function(){var e=this,t=this.getCurrentDateTime().getHours();"12"===this.props.hourFormat&&(0===t?t=12:t>11&&12!==t&&(t-=12));var n=t<10?"0"+t:t;return h.default.createElement("div",{className:"p-hour-picker"},h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,0,1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-up"}),h.default.createElement(l.Ripple,null)),h.default.createElement("span",null,n),h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,0,-1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-down"}),h.default.createElement(l.Ripple,null)))}},{key:"renderMinutePicker",value:function(){var e=this,t=this.getCurrentDateTime().getMinutes(),n=t<10?"0"+t:t;return h.default.createElement("div",{className:"p-minute-picker"},h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,1,1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-up"}),h.default.createElement(l.Ripple,null)),h.default.createElement("span",null,n),h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,1,-1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-down"}),h.default.createElement(l.Ripple,null)))}},{key:"renderSecondPicker",value:function(){var e=this;if(this.props.showSeconds){var t=this.getCurrentDateTime().getSeconds(),n=t<10?"0"+t:t;return h.default.createElement("div",{className:"p-second-picker"},h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,2,1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-up"}),h.default.createElement(l.Ripple,null)),h.default.createElement("span",null,n),h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,2,-1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-down"}),h.default.createElement(l.Ripple,null)))}return null}},{key:"renderMiliSecondPicker",value:function(){var e=this;if(this.props.showMillisec){var t=this.getCurrentDateTime().getMilliseconds(),n=t<100?(t<10?"00":"0")+t:t;return h.default.createElement("div",{className:"p-millisecond-picker"},h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,3,1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-up"}),h.default.createElement(l.Ripple,null)),h.default.createElement("span",null,n),h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,3,-1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-down"}),h.default.createElement(l.Ripple,null)))}return null}},{key:"renderAmPmPicker",value:function(){if("12"===this.props.hourFormat){var e=this.getCurrentDateTime().getHours()>11?"PM":"AM";return h.default.createElement("div",{className:"p-ampm-picker"},h.default.createElement("button",{type:"button",className:"p-link",onClick:this.toggleAmPm},h.default.createElement("span",{className:"pi pi-chevron-up"}),h.default.createElement(l.Ripple,null)),h.default.createElement("span",null,e),h.default.createElement("button",{type:"button",className:"p-link",onClick:this.toggleAmPm},h.default.createElement("span",{className:"pi pi-chevron-down"}),h.default.createElement(l.Ripple,null)))}return null}},{key:"renderSeparator",value:function(e){return h.default.createElement("div",{className:"p-separator"},h.default.createElement("span",null,e))}},{key:"renderTimePicker",value:function(){return this.props.showTime||this.props.timeOnly?h.default.createElement("div",{className:"p-timepicker"},this.renderHourPicker(),this.renderSeparator(":"),this.renderMinutePicker(),this.props.showSeconds&&this.renderSeparator(":"),this.renderSecondPicker(),this.props.showMillisec&&this.renderSeparator("."),this.renderMiliSecondPicker(),"12"===this.props.hourFormat&&this.renderSeparator(":"),this.renderAmPmPicker()):null}},{key:"renderInputElement",value:function(){return this.props.inline?null:h.default.createElement(n.InputText,{ref:this.inputRef,id:this.props.inputId,name:this.props.name,type:"text",className:this.props.inputClassName,style:this.props.inputStyle,readOnly:this.props.readOnlyInput,disabled:this.props.disabled,required:this.props.required,autoComplete:"off",placeholder:this.props.placeholder,tabIndex:this.props.tabIndex,onInput:this.onUserInput,onFocus:this.onInputFocus,onBlur:this.onInputBlur,onKeyDown:this.onInputKeyDown,"aria-labelledby":this.props.ariaLabelledBy,inputMode:this.props.inputMode})}},{key:"renderButton",value:function(){return this.props.showIcon?h.default.createElement(i.Button,{type:"button",icon:this.props.icon,onClick:this.onButtonClick,tabIndex:"-1",disabled:this.props.disabled,className:"p-datepicker-trigger"}):null}},{key:"renderContent",value:function(){var e=this.renderInputElement(),t=this.renderButton();return"left"===this.props.iconPos?h.default.createElement(h.default.Fragment,null,t,e):h.default.createElement(h.default.Fragment,null,e,t)}},{key:"renderButtonBar",value:function(){var e=this;if(this.props.showButtonBar){var t=a.classNames("p-button-text",this.props.todayButtonClassName),n=a.classNames("p-button-text",this.props.clearButtonClassName),r=u.localeOptions(this.props.locale),s=r.clear;return h.default.createElement("div",{className:"p-datepicker-buttonbar"},h.default.createElement(i.Button,{type:"button",label:r.today,onClick:this.onTodayButtonClick,onKeyDown:function(t){return e.onContainerButtonKeydown(t)},className:t}),h.default.createElement(i.Button,{type:"button",label:s,onClick:this.onClearButtonClick,onKeyDown:function(t){return e.onContainerButtonKeydown(t)},className:n}))}return null}},{key:"renderFooter",value:function(){if(this.props.footerTemplate){var e=this.props.footerTemplate();return h.default.createElement("div",{className:"p-datepicker-footer"},e)}return null}},{key:"render",value:function(){var e,t=this,n=a.classNames("p-calendar p-component p-inputwrapper",this.props.className,(O(e={},"p-calendar-w-btn p-calendar-w-btn-".concat(this.props.iconPos),this.props.showIcon),O(e,"p-calendar-disabled",this.props.disabled),O(e,"p-calendar-timeonly",this.props.timeOnly),O(e,"p-inputwrapper-filled",this.props.value||a.DomHandler.hasClass(this.inputRef.current,"p-filled")&&""!==this.inputRef.current.value),O(e,"p-inputwrapper-focus",this.state.focused),e)),i=a.classNames("p-datepicker p-component",this.props.panelClassName,{"p-datepicker-inline":this.props.inline,"p-disabled":this.props.disabled,"p-datepicker-timeonly":this.props.timeOnly,"p-datepicker-multiple-month":this.props.numberOfMonths>1,"p-datepicker-monthpicker":"month"===this.props.view,"p-datepicker-touch-ui":this.props.touchUI}),r=this.renderContent(),s=this.renderDatePicker(),o=this.renderTimePicker(),l=this.renderButtonBar(),u=this.renderFooter(),p=this.props.inline||this.isVisible();return h.default.createElement("span",{ref:function(e){return t.container=e},id:this.props.id,className:n,style:this.props.style},r,h.default.createElement(H,{ref:this.overlayRef,className:i,style:this.props.panelStyle,appendTo:this.props.appendTo,inline:this.props.inline,onClick:this.onPanelClick,onMouseUp:this.onPanelMouseUp,in:p,onEnter:this.onOverlayEnter,onEntered:this.onOverlayEntered,onExit:this.onOverlayExit,onExited:this.onOverlayExited,transitionOptions:this.props.transitionOptions},s,o,l,u))}}]),v}(t.Component);return O(L,"defaultProps",{id:null,inputRef:null,name:null,value:null,visible:!1,viewDate:null,style:null,className:null,inline:!1,selectionMode:"single",inputId:null,inputStyle:null,inputClassName:null,inputMode:"none",required:!1,readOnlyInput:!1,keepInvalid:!1,mask:null,disabled:!1,tabIndex:null,placeholder:null,showIcon:!1,icon:"pi pi-calendar",iconPos:"right",showOnFocus:!0,numberOfMonths:1,view:"date",touchUI:!1,showTime:!1,timeOnly:!1,showSeconds:!1,showMillisec:!1,hourFormat:"24",stepHour:1,stepMinute:1,stepSecond:1,stepMillisec:1,shortYearCutoff:"+10",hideOnDateTimeSelect:!1,showWeek:!1,locale:null,dateFormat:null,panelStyle:null,panelClassName:null,monthNavigator:!1,yearNavigator:!1,yearRange:null,disabledDates:null,disabledDays:null,minDate:null,maxDate:null,maxDateCount:null,showOtherMonths:!0,selectOtherMonths:!1,showButtonBar:!1,todayButtonClassName:"p-button-secondary",clearButtonClassName:"p-button-secondary",autoZIndex:!0,baseZIndex:0,appendTo:null,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,dateTemplate:null,headerTemplate:null,footerTemplate:null,monthNavigatorTemplate:null,yearNavigatorTemplate:null,transitionOptions:null,onVisibleChange:null,onFocus:null,onBlur:null,onInput:null,onSelect:null,onChange:null,onViewDateChange:null,onTodayButtonClick:null,onClearButtonClick:null,onShow:null,onHide:null}),e.Calendar=L,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.inputtext,primereact.button,primereact.csstransition,primereact.portal,primereact.utils,primereact.tooltip,primereact.ripple,primereact.api,primereact.overlayservice);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.calendar=function(e,t,n,i,r,s,a,o,l,u,p){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=c(t),d=c(u);function m(){return m=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},m.apply(this,arguments)}function f(e){return f="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},f(e)}function v(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(e){if(Array.isArray(e))return v(e)}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function D(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}function k(){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 M(e){return g(e)||y(e)||D(e)||k()}function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(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 S(e,t,n){return t&&w(e.prototype,t),n&&w(e,n),e}function E(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function T(e,t){return T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},T(e,t)}function C(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}}),t&&T(e,t)}function x(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return E(e)}function I(e){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},I(e)}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N(){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(e){C(a,e);var t,n,i=(t=a,n=N(),function(){var e,i=I(t);if(n){var r=I(this).constructor;e=Reflect.construct(i,arguments,r)}else e=i.apply(this,arguments);return x(this,e)});function a(){return b(this,a),i.apply(this,arguments)}return S(a,[{key:"renderElement",value:function(){return h.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.props.onEnter,onEntered:this.props.onEntered,onExit:this.props.onExit,onExited:this.props.onExited},h.default.createElement("div",{ref:this.props.forwardRef,className:this.props.className,style:this.props.style,onClick:this.props.onClick,onMouseUp:this.props.onMouseUp},this.props.children))}},{key:"render",value:function(){var e=this.renderElement();return this.props.inline?e:h.default.createElement(s.Portal,{element:e,appendTo:this.props.appendTo})}}]),a}(t.Component);O(F,"defaultProps",{appendTo:null,style:null,className:null});var H=h.default.forwardRef((function(e,t){return h.default.createElement(F,m({forwardRef:t},e))}));function P(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=R(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 s,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw s}}}}function R(e,t){if(e){if("string"==typeof e)return B(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)?B(e,t):void 0}}function B(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 V(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 Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach((function(t){O(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function U(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var L=function(e){C(v,e);var r,s,c=(r=v,s=U(),function(){var e,t=I(r);if(s){var n=I(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return x(this,e)});function v(e){var n;if(b(this,v),(n=c.call(this,e)).state={focused:!1,overlayVisible:!1},!n.props.onViewDateChange){var i=n.getViewDate(n.props.viewDate);n.validateDate(i),n.state=Y(Y({},n.state),{},{viewDate:i})}return n.navigation=null,n.onUserInput=n.onUserInput.bind(E(n)),n.onInputFocus=n.onInputFocus.bind(E(n)),n.onInputBlur=n.onInputBlur.bind(E(n)),n.onInputKeyDown=n.onInputKeyDown.bind(E(n)),n.onButtonClick=n.onButtonClick.bind(E(n)),n.onPrevButtonClick=n.onPrevButtonClick.bind(E(n)),n.onNextButtonClick=n.onNextButtonClick.bind(E(n)),n.onMonthDropdownChange=n.onMonthDropdownChange.bind(E(n)),n.onYearDropdownChange=n.onYearDropdownChange.bind(E(n)),n.onTodayButtonClick=n.onTodayButtonClick.bind(E(n)),n.onClearButtonClick=n.onClearButtonClick.bind(E(n)),n.onPanelClick=n.onPanelClick.bind(E(n)),n.onPanelMouseUp=n.onPanelMouseUp.bind(E(n)),n.incrementHour=n.incrementHour.bind(E(n)),n.decrementHour=n.decrementHour.bind(E(n)),n.incrementMinute=n.incrementMinute.bind(E(n)),n.decrementMinute=n.decrementMinute.bind(E(n)),n.incrementSecond=n.incrementSecond.bind(E(n)),n.decrementSecond=n.decrementSecond.bind(E(n)),n.toggleAmPm=n.toggleAmPm.bind(E(n)),n.onTimePickerElementMouseDown=n.onTimePickerElementMouseDown.bind(E(n)),n.onTimePickerElementMouseUp=n.onTimePickerElementMouseUp.bind(E(n)),n.onTimePickerElementMouseLeave=n.onTimePickerElementMouseLeave.bind(E(n)),n.onOverlayEnter=n.onOverlayEnter.bind(E(n)),n.onOverlayEntered=n.onOverlayEntered.bind(E(n)),n.onOverlayExit=n.onOverlayExit.bind(E(n)),n.onOverlayExited=n.onOverlayExited.bind(E(n)),n.reFocusInputField=n.reFocusInputField.bind(E(n)),n.overlayRef=t.createRef(),n.inputRef=t.createRef(n.props.inputRef),n}return S(v,[{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(){var e=this;this.updateInputRef(),this.props.tooltip&&this.renderTooltip(),this.props.inline?this.initFocusableCell():this.props.mask&&a.mask(this.inputRef.current,{mask:this.props.mask,readOnly:this.props.readOnlyInput||this.props.disabled,onChange:function(t){return e.updateValueOnInput(t.originalEvent,t.value)}}),this.props.value&&this.updateInputfield(this.props.value)}},{key:"componentDidUpdate",value:function(e){var t=this;if(e.tooltip===this.props.tooltip&&e.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(Y({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),!this.props.onViewDateChange&&!this.viewStateChanged){var n=this.props.value;Array.isArray(n)&&(n=n[0]);var i=e.value;if(Array.isArray(i)&&(i=i[0]),!i&&n||n&&n instanceof Date&&n.getTime()!==i.getTime()){var r=this.props.viewDate&&this.isValidDate(this.props.viewDate)?this.props.viewDate:n&&this.isValidDate(n)?n:new Date;this.validateDate(r),this.setState({viewDate:r},(function(){t.viewStateChanged=!0}))}}this.overlayRef&&this.overlayRef.current&&this.updateFocus(),(e.value===this.props.value||this.viewStateChanged&&this.isVisible())&&!this.isOptionChanged(e)||this.updateInputfield(this.props.value)}},{key:"componentWillUnmount",value:function(){this.hideTimeout&&clearTimeout(this.hideTimeout),this.touchUIMask&&(this.disableModality(),this.touchUIMask=null),this.tooltip&&(this.tooltip.destroy(),this.tooltip=null),this.unbindDocumentClickListener(),this.unbindDocumentResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),a.ZIndexUtils.clear(this.overlayRef.current)}},{key:"renderTooltip",value:function(){this.tooltip=o.tip({target:this.inputRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"isVisible",value:function(){return this.props.onVisibleChange?this.props.visible:this.state.overlayVisible}},{key:"isOptionChanged",value:function(e){var t=this;return["dateFormat","hourFormat","timeOnly","showSeconds","showMillisec"].some((function(n){return e[n]!==t.props[n]}))}},{key:"getDateFormat",value:function(){return this.props.dateFormat||u.localeOption("dateFormat",this.props.locale)}},{key:"onInputFocus",value:function(e){var t=this;this.ignoreFocusFunctionality?this.setState({focused:!0},(function(){t.ignoreFocusFunctionality=!1})):(e.persist(),this.props.showOnFocus&&!this.isVisible()&&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),t.props.keepInvalid||t.updateInputfield(t.props.value)}))}},{key:"onInputKeyDown",value:function(e){switch(this.isKeydown=!0,e.which){case 27:this.hideOverlay();break;case 9:this.isVisible()&&this.trapFocus(e),this.props.touchUI&&this.disableModality()}}},{key:"onUserInput",value:function(e){this.isKeydown&&(this.isKeydown=!1,this.updateValueOnInput(e,e.target.value),this.props.onInput&&this.props.onInput(e))}},{key:"updateValueOnInput",value:function(e,t){try{var n=this.parseValueFromString(t);this.isValidSelection(n)&&(this.updateModel(e,n),this.updateViewDate(e,n.length?n[0]:n))}catch(n){this.updateModel(e,this.props.keepInvalid?t:null)}}},{key:"reFocusInputField",value:function(){!this.props.inline&&this.inputRef.current&&(this.ignoreFocusFunctionality=!0,this.inputRef.current.focus())}},{key:"isValidSelection",value:function(e){var t=this,n=!0;return this.isSingleSelection()?this.isSelectable(e.getDate(),e.getMonth(),e.getFullYear(),!1)&&this.isSelectableTime(e)||(n=!1):e.every((function(e){return t.isSelectable(e.getDate(),e.getMonth(),e.getFullYear(),!1)&&t.isSelectableTime(e)}))&&this.isRangeSelection()&&(n=e.length>1&&e[1]>e[0]),n}},{key:"onButtonClick",value:function(){this.isVisible()?this.hideOverlay():this.showOverlay()}},{key:"onPrevButtonClick",value:function(e){this.navigation={backward:!0,button:!0},this.navBackward(e)}},{key:"onNextButtonClick",value:function(e){this.navigation={backward:!1,button:!0},this.navForward(e)}},{key:"onContainerButtonKeydown",value:function(e){switch(e.which){case 9:this.trapFocus(e);break;case 27:this.hideOverlay(null,this.reFocusInputField),e.preventDefault()}}},{key:"trapFocus",value:function(e){e.preventDefault();var t=a.DomHandler.getFocusableElements(this.overlayRef.current);if(t&&t.length>0)if(document.activeElement){var n=t.indexOf(document.activeElement);e.shiftKey?-1===n||0===n?t[t.length-1].focus():t[n-1].focus():-1===n||n===t.length-1?t[0].focus():t[n+1].focus()}else t[0].focus()}},{key:"updateFocus",value:function(){var e;if(this.navigation){if(this.navigation.button)this.initFocusableCell(),this.navigation.backward?a.DomHandler.findSingle(this.overlayRef.current,".p-datepicker-prev").focus():a.DomHandler.findSingle(this.overlayRef.current,".p-datepicker-next").focus();else{if(this.navigation.backward){var t=a.DomHandler.find(this.overlayRef.current,".p-datepicker-calendar td span:not(.p-disabled)");e=t[t.length-1]}else e=a.DomHandler.findSingle(this.overlayRef.current,".p-datepicker-calendar td span:not(.p-disabled)");e&&(e.tabIndex="0",e.focus())}this.navigation=null}else this.initFocusableCell()}},{key:"initFocusableCell",value:function(){var e;if("month"===this.view){var t=a.DomHandler.find(this.overlayRef.current,".p-monthpicker .p-monthpicker-month"),n=a.DomHandler.findSingle(this.overlayRef.current,".p-monthpicker .p-monthpicker-month.p-highlight");t.forEach((function(e){return e.tabIndex=-1})),e=n||t[0]}else if(!(e=a.DomHandler.findSingle(this.overlayRef.current,"span.p-highlight"))){var i=a.DomHandler.findSingle(this.overlayRef.current,"td.p-datepicker-today span:not(.p-disabled)");e=i||a.DomHandler.findSingle(this.overlayRef.current,".p-datepicker-calendar td span:not(.p-disabled)")}e&&(e.tabIndex="0")}},{key:"navBackward",value:function(e){if(this.props.disabled)e.preventDefault();else{var t=new Date(this.getViewDate().getTime());if(t.setDate(1),"date"===this.props.view)0===t.getMonth()?(t.setMonth(11),t.setFullYear(t.getFullYear()-1)):t.setMonth(t.getMonth()-1);else if("month"===this.props.view){var n=t.getFullYear()-1;if(this.props.yearNavigator){var i=parseInt(this.props.yearRange.split(":")[0],10);n<i&&(n=i)}t.setFullYear(n)}this.updateViewDate(e,t),e.preventDefault()}}},{key:"navForward",value:function(e){if(this.props.disabled)e.preventDefault();else{var t=new Date(this.getViewDate().getTime());if(t.setDate(1),"date"===this.props.view)11===t.getMonth()?(t.setMonth(0),t.setFullYear(t.getFullYear()+1)):t.setMonth(t.getMonth()+1);else if("month"===this.props.view){var n=t.getFullYear()+1;if(this.props.yearNavigator){var i=parseInt(this.props.yearRange.split(":")[1],10);n>i&&(n=i)}t.setFullYear(n)}this.updateViewDate(e,t),e.preventDefault()}}},{key:"onMonthDropdownChange",value:function(e,t){var n=this.getViewDate(),i=new Date(n.getTime());i.setMonth(parseInt(t,10)),this.updateViewDate(e,i)}},{key:"onYearDropdownChange",value:function(e,t){var n=this.getViewDate(),i=new Date(n.getTime());i.setFullYear(parseInt(t,10)),this.updateViewDate(e,i)}},{key:"onTodayButtonClick",value:function(e){var t=new Date,n={day:t.getDate(),month:t.getMonth(),year:t.getFullYear(),today:!0,selectable:!0},i={hours:t.getHours(),minutes:t.getMinutes(),seconds:t.getSeconds(),milliseconds:t.getMilliseconds()};this.updateViewDate(e,t),this.onDateSelect(e,n,i),this.props.onTodayButtonClick&&this.props.onTodayButtonClick(e)}},{key:"onClearButtonClick",value:function(e){this.updateModel(e,null),this.updateInputfield(null),this.hideOverlay(null,this.reFocusInputField),this.props.onClearButtonClick&&this.props.onClearButtonClick(e)}},{key:"onPanelClick",value:function(e){this.props.inline||p.OverlayService.emit("overlay-click",{originalEvent:e,target:this.container})}},{key:"onPanelMouseUp",value:function(e){this.onPanelClick(e)}},{key:"onTimePickerElementMouseDown",value:function(e,t,n){this.props.disabled||(this.repeat(e,null,t,n),e.preventDefault())}},{key:"onTimePickerElementMouseUp",value:function(){this.props.disabled||this.clearTimePickerTimer()}},{key:"onTimePickerElementMouseLeave",value:function(){this.props.disabled||this.clearTimePickerTimer()}},{key:"repeat",value:function(e,t,n,i){var r=this;e.persist();var s=t||500;switch(this.clearTimePickerTimer(),this.timePickerTimer=setTimeout((function(){r.repeat(e,100,n,i)}),s),n){case 0:1===i?this.incrementHour(e):this.decrementHour(e);break;case 1:1===i?this.incrementMinute(e):this.decrementMinute(e);break;case 2:1===i?this.incrementSecond(e):this.decrementSecond(e);break;case 3:1===i?this.incrementMilliSecond(e):this.decrementMilliSecond(e)}}},{key:"clearTimePickerTimer",value:function(){this.timePickerTimer&&clearTimeout(this.timePickerTimer)}},{key:"incrementHour",value:function(e){var t=this.getCurrentDateTime(),n=t.getHours()+this.props.stepHour;this.validateHour(n=n>=24?n-24:n,t)&&(this.props.maxDate&&this.props.maxDate.toDateString()===t.toDateString()&&this.props.maxDate.getHours()===n&&(this.props.maxDate.getMinutes()<t.getMinutes()||this.props.maxDate.getMinutes()===t.getMinutes())?this.props.maxDate.getSeconds()<t.getSeconds()?this.props.maxDate.getMilliseconds()<t.getMilliseconds()?this.updateTime(e,n,this.props.maxDate.getMinutes(),this.props.maxDate.getSeconds(),this.props.maxDate.getMilliseconds()):this.updateTime(e,n,this.props.maxDate.getMinutes(),this.props.maxDate.getSeconds(),t.getMilliseconds()):this.updateTime(e,n,this.props.maxDate.getMinutes(),t.getSeconds(),t.getMilliseconds()):this.updateTime(e,n,t.getMinutes(),t.getSeconds(),t.getMilliseconds())),e.preventDefault()}},{key:"decrementHour",value:function(e){var t=this.getCurrentDateTime(),n=t.getHours()-this.props.stepHour;this.validateHour(n=n<0?n+24:n,t)&&(this.props.minDate&&this.props.minDate.toDateString()===t.toDateString()&&this.props.minDate.getHours()===n&&(this.props.minDate.getMinutes()>t.getMinutes()||this.props.minDate.getMinutes()===t.getMinutes())?this.props.minDate.getSeconds()>t.getSeconds()?this.props.minDate.getMilliseconds()>t.getMilliseconds()?this.updateTime(e,n,this.props.minDate.getMinutes(),this.props.minDate.getSeconds(),this.props.minDate.getMilliseconds()):this.updateTime(e,n,this.props.minDate.getMinutes(),this.props.minDate.getSeconds(),t.getMilliseconds()):this.updateTime(e,n,this.props.minDate.getMinutes(),t.getSeconds(),t.getMilliseconds()):this.updateTime(e,n,t.getMinutes(),t.getSeconds(),t.getMilliseconds())),e.preventDefault()}},{key:"doStepMinute",value:function(e,t){if(this.props.stepMinute<=1)return e;if(!t&&e%(t=this.props.stepMinute)==0)return e;var n=e+t;return n=Math.floor(n/t)*t}},{key:"incrementMinute",value:function(e){var t=this.getCurrentDateTime(),n=t.getMinutes(),i=this.doStepMinute(n,this.props.stepMinute);this.validateMinute(i=i>59?i-60:i,t)&&(this.props.maxDate&&this.props.maxDate.toDateString()===t.toDateString()&&this.props.maxDate.getMinutes()===i&&this.props.maxDate.getSeconds()<t.getSeconds()?this.props.maxDate.getMilliseconds()<t.getMilliseconds()?this.updateTime(e,t.getHours(),i,this.props.maxDate.getSeconds(),this.props.maxDate.getMilliseconds()):this.updateTime(e,t.getHours(),i,this.props.maxDate.getSeconds(),t.getMilliseconds()):this.updateTime(e,t.getHours(),i,t.getSeconds(),t.getMilliseconds())),e.preventDefault()}},{key:"decrementMinute",value:function(e){var t=this.getCurrentDateTime(),n=t.getMinutes(),i=this.doStepMinute(n,-this.props.stepMinute);this.validateMinute(i=i<0?i+60:i,t)&&(this.props.minDate&&this.props.minDate.toDateString()===t.toDateString()&&this.props.minDate.getMinutes()===i&&this.props.minDate.getSeconds()>t.getSeconds()?this.props.minDate.getMilliseconds()>t.getMilliseconds()?this.updateTime(e,t.getHours(),i,this.props.minDate.getSeconds(),this.props.minDate.getMilliseconds()):this.updateTime(e,t.getHours(),i,this.props.minDate.getSeconds(),t.getMilliseconds()):this.updateTime(e,t.getHours(),i,t.getSeconds(),t.getMilliseconds())),e.preventDefault()}},{key:"incrementSecond",value:function(e){var t=this.getCurrentDateTime(),n=t.getSeconds()+this.props.stepSecond;this.validateSecond(n=n>59?n-60:n,t)&&(this.props.maxDate&&this.props.maxDate.toDateString()===t.toDateString()&&this.props.maxDate.getSeconds()===n&&this.props.maxDate.getMilliseconds()<t.getMilliseconds()?this.updateTime(e,t.getHours(),t.getMinutes(),n,this.props.maxDate.getMilliseconds()):this.updateTime(e,t.getHours(),t.getMinutes(),n,t.getMilliseconds())),e.preventDefault()}},{key:"decrementSecond",value:function(e){var t=this.getCurrentDateTime(),n=t.getSeconds()-this.props.stepSecond;this.validateSecond(n=n<0?n+60:n,t)&&(this.props.minDate&&this.props.minDate.toDateString()===t.toDateString()&&this.props.minDate.getSeconds()===n&&this.props.minDate.getMilliseconds()>t.getMilliseconds()?this.updateTime(e,t.getHours(),t.getMinutes(),n,this.props.minDate.getMilliseconds()):this.updateTime(e,t.getHours(),t.getMinutes(),n,t.getMilliseconds())),e.preventDefault()}},{key:"incrementMilliSecond",value:function(e){var t=this.getCurrentDateTime(),n=t.getMilliseconds()+this.props.stepMillisec;this.validateMillisecond(n=n>999?n-1e3:n,t)&&this.updateTime(e,t.getHours(),t.getMinutes(),t.getSeconds(),n),e.preventDefault()}},{key:"decrementMilliSecond",value:function(e){var t=this.getCurrentDateTime(),n=t.getMilliseconds()-this.props.stepMillisec;this.validateMillisecond(n=n<0?n+999:n,t)&&this.updateTime(e,t.getHours(),t.getMinutes(),t.getSeconds(),n),e.preventDefault()}},{key:"toggleAmPm",value:function(e){var t=this.getCurrentDateTime(),n=t.getHours();this.updateTime(e,n>=12?n-12:n+12,t.getMinutes(),t.getSeconds(),t.getMilliseconds()),e.preventDefault()}},{key:"getViewDate",value:function(e){var t=this.props.value,n=e||(this.props.onViewDateChange?this.props.viewDate:this.state.viewDate);return Array.isArray(t)&&(t=t[0]),n&&this.isValidDate(n)?n:t&&this.isValidDate(t)?t:new Date}},{key:"getCurrentDateTime",value:function(){if(this.isSingleSelection())return this.props.value&&this.props.value instanceof Date?this.props.value:this.getViewDate();if(this.isMultipleSelection()){if(this.props.value&&this.props.value.length)return this.props.value[this.props.value.length-1]}else if(this.isRangeSelection()){if(this.props.value&&this.props.value.length)return this.props.value[1]||this.props.value[0]}return new Date}},{key:"isValidDate",value:function(e){return e instanceof Date&&!isNaN(e)}},{key:"validateHour",value:function(e,t){var n=!0,i=t?t.toDateString():null;return this.props.minDate&&i&&this.props.minDate.toDateString()===i&&this.props.minDate.getHours()>e&&(n=!1),this.props.maxDate&&i&&this.props.maxDate.toDateString()===i&&this.props.maxDate.getHours()<e&&(n=!1),n}},{key:"validateMinute",value:function(e,t){var n=!0,i=t?t.toDateString():null;return this.props.minDate&&i&&this.props.minDate.toDateString()===i&&t.getHours()===this.props.minDate.getHours()&&this.props.minDate.getMinutes()>e&&(n=!1),this.props.maxDate&&i&&this.props.maxDate.toDateString()===i&&t.getHours()===this.props.maxDate.getHours()&&this.props.maxDate.getMinutes()<e&&(n=!1),n}},{key:"validateSecond",value:function(e,t){var n=!0,i=t?t.toDateString():null;return this.props.minDate&&i&&this.props.minDate.toDateString()===i&&t.getHours()===this.props.minDate.getHours()&&t.getMinutes()===this.props.minDate.getMinutes()&&this.props.minDate.getSeconds()>e&&(n=!1),this.props.maxDate&&i&&this.props.maxDate.toDateString()===i&&t.getHours()===this.props.maxDate.getHours()&&t.getMinutes()===this.props.maxDate.getMinutes()&&this.props.maxDate.getSeconds()<e&&(n=!1),n}},{key:"validateMillisecond",value:function(e,t){var n=!0,i=t?t.toDateString():null;return this.props.minDate&&i&&this.props.minDate.toDateString()===i&&t.getHours()===this.props.minDate.getHours()&&t.getSeconds()===this.props.minDate.getSeconds()&&t.getMinutes()===this.props.minDate.getMinutes()&&this.props.minDate.getMilliseconds()>e&&(n=!1),this.props.maxDate&&i&&this.props.maxDate.toDateString()===i&&t.getHours()===this.props.maxDate.getHours()&&t.getSeconds()===this.props.maxDate.getSeconds()&&t.getMinutes()===this.props.maxDate.getMinutes()&&this.props.maxDate.getMilliseconds()<e&&(n=!1),n}},{key:"validateDate",value:function(e){if(this.props.yearNavigator){var t=e.getFullYear(),n=this.props.yearRange?parseInt(this.props.yearRange.split(":")[0],10):null,i=this.props.yearRange?parseInt(this.props.yearRange.split(":")[1],10):null,r=this.props.minDate&&null!=n?Math.max(this.props.minDate.getFullYear(),n):this.props.minDate||n,s=this.props.maxDate&&null!=i?Math.min(this.props.maxDate.getFullYear(),i):this.props.maxDate||i;r&&r>t&&(t=r),s&&s<t&&(t=s),e.setFullYear(t)}if(this.props.monthNavigator&&"month"!==this.props.view){var a=e.getMonth(),o=parseInt(this.isInMinYear(e)&&Math.max(this.props.minDate.getMonth(),a).toString()||this.isInMaxYear(e)&&Math.min(this.props.maxDate.getMonth(),a).toString()||a);e.setMonth(o)}}},{key:"updateTime",value:function(e,t,n,i,r){var s=this.getCurrentDateTime();if(s.setHours(t),s.setMinutes(n),s.setSeconds(i),s.setMilliseconds(r),this.isMultipleSelection())if(this.props.value&&this.props.value.length){var a=M(this.props.value);a[a.length-1]=s,s=a}else s=[s];else if(this.isRangeSelection()){if(this.props.value&&this.props.value.length)s=this.props.value[1]?[this.props.value[0],s]:[s,null];else s=[s,null]}this.updateModel(e,s),this.props.onSelect&&this.props.onSelect({originalEvent:e,value:s}),this.updateInputfield(s)}},{key:"updateViewDate",value:function(e,t){this.validateDate(t),this.props.onViewDateChange?this.props.onViewDateChange({originalEvent:e,value:t}):(this.viewStateChanged=!0,this.setState({viewDate:t}))}},{key:"onDateCellKeydown",value:function(e,t,n){var i=e.currentTarget,r=i.parentElement;switch(e.which){case 40:i.tabIndex="-1";var s=a.DomHandler.index(r),o=r.parentElement.nextElementSibling;if(o)a.DomHandler.hasClass(o.children[s].children[0],"p-disabled")?(this.navigation={backward:!1},this.navForward(e)):(o.children[s].children[0].tabIndex="0",o.children[s].children[0].focus());else this.navigation={backward:!1},this.navForward(e);e.preventDefault();break;case 38:i.tabIndex="-1";var l=a.DomHandler.index(r),u=r.parentElement.previousElementSibling;if(u){var p=u.children[l].children[0];a.DomHandler.hasClass(p,"p-disabled")?(this.navigation={backward:!0},this.navBackward(e)):(p.tabIndex="0",p.focus())}else this.navigation={backward:!0},this.navBackward(e);e.preventDefault();break;case 37:i.tabIndex="-1";var c=r.previousElementSibling;if(c){var h=c.children[0];a.DomHandler.hasClass(h,"p-disabled")?this.navigateToMonth(!0,n,e):(h.tabIndex="0",h.focus())}else this.navigateToMonth(!0,n,e);e.preventDefault();break;case 39:i.tabIndex="-1";var d=r.nextElementSibling;if(d){var m=d.children[0];a.DomHandler.hasClass(m,"p-disabled")?this.navigateToMonth(!1,n,e):(m.tabIndex="0",m.focus())}else this.navigateToMonth(!1,n,e);e.preventDefault();break;case 13:this.onDateSelect(e,t),e.preventDefault();break;case 27:this.hideOverlay(null,this.reFocusInputField),e.preventDefault();break;case 9:this.trapFocus(e)}}},{key:"navigateToMonth",value:function(e,t,n){if(e)if(1===this.props.numberOfMonths||0===t)this.navigation={backward:!0},this.navBackward(n);else{var i=a.DomHandler.find(this.overlayRef.current.children[t-1],".p-datepicker-calendar td span:not(.p-disabled)"),r=i[i.length-1];r.tabIndex="0",r.focus()}else if(1===this.props.numberOfMonths||t===this.props.numberOfMonths-1)this.navigation={backward:!1},this.navForward(n);else{var s=a.DomHandler.findSingle(this.overlayRef.current.children[t+1],".p-datepicker-calendar td span:not(.p-disabled)");s.tabIndex="0",s.focus()}}},{key:"onMonthCellKeydown",value:function(e,t){var n=e.currentTarget;switch(e.which){case 38:case 40:n.tabIndex="-1";var i=n.parentElement.children,r=a.DomHandler.index(n),s=i[40===e.which?r+3:r-3];s&&(s.tabIndex="0",s.focus()),e.preventDefault();break;case 37:n.tabIndex="-1";var o=n.previousElementSibling;o&&(o.tabIndex="0",o.focus()),e.preventDefault();break;case 39:n.tabIndex="-1";var l=n.nextElementSibling;l&&(l.tabIndex="0",l.focus()),e.preventDefault();break;case 13:this.onMonthSelect(e,t),e.preventDefault();break;case 27:this.hideOverlay(null,this.reFocusInputField),e.preventDefault();break;case 9:this.trapFocus(e)}}},{key:"onDateSelect",value:function(e,t,n){var i=this;if(!this.props.disabled&&t.selectable){if(a.DomHandler.find(this.overlayRef.current,".p-datepicker-calendar td span:not(.p-disabled)").forEach((function(e){return e.tabIndex=-1})),e.currentTarget.focus(),this.isMultipleSelection())if(this.isSelected(t)){var r=this.props.value.filter((function(e,n){return!i.isDateEquals(e,t)}));this.updateModel(e,r),this.updateInputfield(r)}else(!this.props.maxDateCount||!this.props.value||this.props.maxDateCount>this.props.value.length)&&this.selectDate(e,t,n);else this.selectDate(e,t,n);this.props.inline||!this.isSingleSelection()||this.props.showTime&&!this.props.hideOnDateTimeSelect||(setTimeout((function(){i.hideOverlay("dateselect")}),100),this.touchUIMask&&this.disableModality()),e.preventDefault()}else e.preventDefault()}},{key:"selectTime",value:function(e,t){if(this.props.showTime){var n,i,r,s;if(t)n=t.hours,i=t.minutes,r=t.seconds,s=t.milliseconds;else{var a=this.getCurrentDateTime(),o=[a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()];n=o[0],i=o[1],r=o[2],s=o[3]}e.setHours(n),e.setMinutes(i),e.setSeconds(r),e.setMilliseconds(s)}}},{key:"selectDate",value:function(e,t,n){var i=new Date(t.year,t.month,t.day);this.selectTime(i,n),this.props.minDate&&this.props.minDate>i&&(i=this.props.minDate),this.props.maxDate&&this.props.maxDate<i&&(i=this.props.maxDate);var r=i;if(this.isSingleSelection())this.updateModel(e,i);else if(this.isMultipleSelection())r=this.props.value?[].concat(M(this.props.value),[i]):[i],this.updateModel(e,r);else if(this.isRangeSelection())if(this.props.value&&this.props.value.length){var s=this.props.value[0],a=this.props.value[1];a?(s=i,a=null):i.getTime()>=s.getTime()?a=i:(a=s,s=i),this.updateModel(e,r=[s,a])}else this.updateModel(e,r=[i,null]);this.props.onSelect&&this.props.onSelect({originalEvent:e,value:i}),this.updateInputfield(r)}},{key:"onMonthSelect",value:function(e,t){this.onDateSelect(e,{year:this.getViewDate().getFullYear(),month:t,day:1,selectable:!0}),e.preventDefault()}},{key:"updateModel",value:function(e,t){if(this.props.onChange){var n=t&&t instanceof Date?new Date(t.getTime()):t;this.viewStateChanged=!0,this.props.onChange({originalEvent:e,value:n,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:n}})}}},{key:"showOverlay",value:function(e){var t=this;this.props.onVisibleChange?this.props.onVisibleChange({visible:!0,type:e}):this.setState({overlayVisible:!0},(function(){t.overlayEventListener=function(e){t.isOutsideClicked(e.target)||(t.isOverlayClicked=!0)},p.OverlayService.on("overlay-click",t.overlayEventListener)}))}},{key:"hideOverlay",value:function(e,t){var n=this,i=function(){n.viewStateChanged=!1,n.ignoreFocusFunctionality=!1,n.isOverlayClicked=!1,t&&t(),p.OverlayService.off("overlay-click",n.overlayEventListener),n.overlayEventListener=null};this.props.onVisibleChange?this.props.onVisibleChange({visible:!1,type:e,callback:i}):this.setState({overlayVisible:!1},i)}},{key:"onOverlayEnter",value:function(){if(this.props.autoZIndex){var e=this.props.touchUI?"modal":"overlay";a.ZIndexUtils.set(e,this.overlayRef.current,d.default.autoZIndex,this.props.baseZIndex||d.default.zIndex[e])}this.alignOverlay()}},{key:"onOverlayEntered",value:function(){this.bindDocumentClickListener(),this.bindDocumentResizeListener(),this.bindScrollListener(),this.props.onShow&&this.props.onShow()}},{key:"onOverlayExit",value:function(){this.unbindDocumentClickListener(),this.unbindDocumentResizeListener(),this.unbindScrollListener()}},{key:"onOverlayExited",value:function(){a.ZIndexUtils.clear(this.overlayRef.current),this.props.onHide&&this.props.onHide()}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){!e.isOverlayClicked&&e.isVisible()&&e.isOutsideClicked(t.target)&&e.hideOverlay("outside"),e.isOverlayClicked=!1},document.addEventListener("click",this.documentClickListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"bindDocumentResizeListener",value:function(){this.documentResizeListener||this.props.touchUI||(this.documentResizeListener=this.onWindowResize.bind(this),window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentResizeListener",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new a.ConnectedOverlayScrollHandler(this.container,(function(){e.isVisible()&&e.hideOverlay()}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"isOutsideClicked",value:function(e){return this.container&&!(this.container.isSameNode(e)||this.isNavIconClicked(e)||this.container.contains(e)||this.overlayRef&&this.overlayRef.current.contains(e))}},{key:"isNavIconClicked",value:function(e){return a.DomHandler.hasClass(e,"p-datepicker-prev")||a.DomHandler.hasClass(e,"p-datepicker-prev-icon")||a.DomHandler.hasClass(e,"p-datepicker-next")||a.DomHandler.hasClass(e,"p-datepicker-next-icon")}},{key:"onWindowResize",value:function(){this.isVisible()&&!a.DomHandler.isTouchDevice()&&this.hideOverlay()}},{key:"alignOverlay",value:function(){this.props.touchUI?this.enableModality():a.DomHandler.alignOverlay(this.overlayRef.current,this.inputRef.current.parentElement,this.props.appendTo||d.default.appendTo)}},{key:"enableModality",value:function(){var e=this;this.touchUIMask||(this.touchUIMask=document.createElement("div"),this.touchUIMask.style.zIndex=String(a.ZIndexUtils.get(this.overlayRef.current)-1),a.DomHandler.addMultipleClasses(this.touchUIMask,"p-component-overlay p-datepicker-mask p-datepicker-mask-scrollblocker p-component-overlay-enter"),this.touchUIMaskClickListener=function(){e.disableModality()},this.touchUIMask.addEventListener("click",this.touchUIMaskClickListener),document.body.appendChild(this.touchUIMask),a.DomHandler.addClass(document.body,"p-overflow-hidden"))}},{key:"disableModality",value:function(){var e=this;this.touchUIMask&&(a.DomHandler.addClass(this.touchUIMask,"p-component-overlay-leave"),this.touchUIMask.addEventListener("animationend",(function(){e.destroyMask()})))}},{key:"destroyMask",value:function(){this.touchUIMask.removeEventListener("click",this.touchUIMaskClickListener),this.touchUIMaskClickListener=null,document.body.removeChild(this.touchUIMask),this.touchUIMask=null;for(var e,t=document.body.children,n=0;n<t.length;n++){if(a.DomHandler.hasClass(t[n],"p-datepicker-mask-scrollblocker")){e=!0;break}}e||a.DomHandler.removeClass(document.body,"p-overflow-hidden")}},{key:"getFirstDayOfMonthIndex",value:function(e,t){var n=new Date;n.setDate(1),n.setMonth(e),n.setFullYear(t);var i=n.getDay()+this.getSundayIndex();return i>=7?i-7:i}},{key:"getDaysCountInMonth",value:function(e,t){return 32-this.daylightSavingAdjust(new Date(t,e,32)).getDate()}},{key:"getDaysCountInPrevMonth",value:function(e,t){var n=this.getPreviousMonthAndYear(e,t);return this.getDaysCountInMonth(n.month,n.year)}},{key:"daylightSavingAdjust",value:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null}},{key:"getPreviousMonthAndYear",value:function(e,t){var n,i;return 0===e?(n=11,i=t-1):(n=e-1,i=t),{month:n,year:i}}},{key:"getNextMonthAndYear",value:function(e,t){var n,i;return 11===e?(n=0,i=t+1):(n=e+1,i=t),{month:n,year:i}}},{key:"getSundayIndex",value:function(){var e=u.localeOption("firstDayOfWeek",this.props.locale);return e>0?7-e:0}},{key:"createWeekDays",value:function(){for(var e=[],t=u.localeOptions(this.props.locale),n=t.firstDayOfWeek,i=t.dayNamesMin,r=0;r<7;r++)e.push(i[n]),n=6===n?0:++n;return e}},{key:"createMonths",value:function(e,t){for(var n=[],i=0;i<this.props.numberOfMonths;i++){var r=e+i,s=t;r>11&&(r=r%11-1,s=t+1),n.push(this.createMonth(r,s))}return n}},{key:"createMonth",value:function(e,t){for(var n=[],i=this.getFirstDayOfMonthIndex(e,t),r=this.getDaysCountInMonth(e,t),s=this.getDaysCountInPrevMonth(e,t),a=1,o=new Date,l=[],u=Math.ceil((r+i)/7),p=0;p<u;p++){var c=[];if(0===p){for(var h=s-i+1;h<=s;h++){var d=this.getPreviousMonthAndYear(e,t);c.push({day:h,month:d.month,year:d.year,otherMonth:!0,today:this.isToday(o,h,d.month,d.year),selectable:this.isSelectable(h,d.month,d.year,!0)})}for(var m=7-c.length,f=0;f<m;f++)c.push({day:a,month:e,year:t,today:this.isToday(o,a,e,t),selectable:this.isSelectable(a,e,t,!1)}),a++}else for(var v=0;v<7;v++){if(a>r){var g=this.getNextMonthAndYear(e,t);c.push({day:a-r,month:g.month,year:g.year,otherMonth:!0,today:this.isToday(o,a-r,g.month,g.year),selectable:this.isSelectable(a-r,g.month,g.year,!0)})}else c.push({day:a,month:e,year:t,today:this.isToday(o,a,e,t),selectable:this.isSelectable(a,e,t,!1)});a++}this.props.showWeek&&l.push(this.getWeekNumber(new Date(c[0].year,c[0].month,c[0].day))),n.push(c)}return{month:e,year:t,dates:n,weekNumbers:l}}},{key:"getWeekNumber",value:function(e){var t=new Date(e.getTime());t.setDate(t.getDate()+4-(t.getDay()||7));var n=t.getTime();return t.setMonth(0),t.setDate(1),Math.floor(Math.round((n-t.getTime())/864e5)/7)+1}},{key:"isSelectable",value:function(e,t,n,i){var r=!0,s=!0,a=!0,o=!0,l=!0;return this.props.minDate&&(this.props.minDate.getFullYear()>n||this.props.minDate.getFullYear()===n&&(this.props.minDate.getMonth()>t||this.props.minDate.getMonth()===t&&this.props.minDate.getDate()>e))&&(r=!1),this.props.maxDate&&(this.props.maxDate.getFullYear()<n||this.props.maxDate.getFullYear()===n&&(this.props.maxDate.getMonth()<t||this.props.maxDate.getMonth()===t&&this.props.maxDate.getDate()<e))&&(s=!1),this.props.disabledDates&&(a=!this.isDateDisabled(e,t,n)),this.props.disabledDays&&(o=!this.isDayDisabled(e,t,n)),!1===this.props.selectOtherMonths&&i&&(l=!1),r&&s&&a&&o&&l}},{key:"isSelectableTime",value:function(e){var t=!0,n=!0;return this.props.minDate&&this.props.minDate.toDateString()===e.toDateString()&&(this.props.minDate.getHours()>e.getHours()||this.props.minDate.getHours()===e.getHours()&&(this.props.minDate.getMinutes()>e.getMinutes()||this.props.minDate.getMinutes()===e.getMinutes()&&(this.props.minDate.getSeconds()>e.getSeconds()||this.props.minDate.getSeconds()===e.getSeconds()&&this.props.minDate.getMilliseconds()>e.getMilliseconds())))&&(t=!1),this.props.maxDate&&this.props.maxDate.toDateString()===e.toDateString()&&(this.props.maxDate.getHours()<e.getHours()||this.props.maxDate.getHours()===e.getHours()&&(this.props.maxDate.getMinutes()<e.getMinutes()||this.props.maxDate.getMinutes()===e.getMinutes()&&(this.props.maxDate.getSeconds()<e.getSeconds()||this.props.maxDate.getSeconds()===e.getSeconds()&&this.props.maxDate.getMilliseconds()<e.getMilliseconds())))&&(n=!1),t&&n}},{key:"isSelected",value:function(e){if(!this.props.value)return!1;if(this.isSingleSelection())return this.isDateEquals(this.props.value,e);if(this.isMultipleSelection()){var t,n=!1,i=P(this.props.value);try{for(i.s();!(t=i.n()).done;){if(n=this.isDateEquals(t.value,e))break}}catch(e){i.e(e)}finally{i.f()}return n}return this.isRangeSelection()?this.props.value[1]?this.isDateEquals(this.props.value[0],e)||this.isDateEquals(this.props.value[1],e)||this.isDateBetween(this.props.value[0],this.props.value[1],e):this.isDateEquals(this.props.value[0],e):void 0}},{key:"isMonthSelected",value:function(e){var t=this.getViewDate();return!!(this.props.value&&this.props.value instanceof Date)&&(1===this.props.value.getDate()&&this.props.value.getMonth()===e&&this.props.value.getFullYear()===t.getFullYear())}},{key:"isDateEquals",value:function(e,t){return!!(e&&e instanceof Date)&&(e.getDate()===t.day&&e.getMonth()===t.month&&e.getFullYear()===t.year)}},{key:"isDateBetween",value:function(e,t,n){if(e&&t){var i=new Date(n.year,n.month,n.day);return e.getTime()<=i.getTime()&&t.getTime()>=i.getTime()}return!1}},{key:"isSingleSelection",value:function(){return"single"===this.props.selectionMode}},{key:"isRangeSelection",value:function(){return"range"===this.props.selectionMode}},{key:"isMultipleSelection",value:function(){return"multiple"===this.props.selectionMode}},{key:"isToday",value:function(e,t,n,i){return e.getDate()===t&&e.getMonth()===n&&e.getFullYear()===i}},{key:"isDateDisabled",value:function(e,t,n){if(this.props.disabledDates)for(var i=0;i<this.props.disabledDates.length;i++){var r=this.props.disabledDates[i];if(r.getFullYear()===n&&r.getMonth()===t&&r.getDate()===e)return!0}return!1}},{key:"isDayDisabled",value:function(e,t,n){if(this.props.disabledDays){var i=new Date(n,t,e).getDay();return-1!==this.props.disabledDays.indexOf(i)}return!1}},{key:"updateInputfield",value:function(e){if(this.inputRef&&this.inputRef.current){var t="";if(e)try{if(this.isSingleSelection())t=this.isValidDate(e)?this.formatDateTime(e):"";else if(this.isMultipleSelection())for(var n=0;n<e.length;n++){var i=e[n];t+=this.isValidDate(i)?this.formatDateTime(i):"",n!==e.length-1&&(t+=", ")}else if(this.isRangeSelection()&&e&&e.length){var r=e[0],s=e[1];t=this.isValidDate(r)?this.formatDateTime(r):"",s&&(t+=this.isValidDate(s)?" - "+this.formatDateTime(s):"")}}catch(n){t=e}this.inputRef.current.value=t}}},{key:"formatDateTime",value:function(e){var t=null;return e&&(this.props.timeOnly?t=this.formatTime(e):(t=this.formatDate(e,this.getDateFormat()),this.props.showTime&&(t+=" "+this.formatTime(e)))),t}},{key:"formatDate",value:function(e,t){if(!e)return"";var n,i=function(e){var i=n+1<t.length&&t.charAt(n+1)===e;return i&&n++,i},r=function(e,t,n){var r=""+t;if(i(e))for(;r.length<n;)r="0"+r;return r},s=function(e,t,n,r){return i(e)?r[t]:n[t]},a="",o=!1,l=u.localeOptions(this.props.locale),p=l.dayNamesShort,c=l.dayNames,h=l.monthNamesShort,d=l.monthNames;if(e)for(n=0;n<t.length;n++)if(o)"'"!==t.charAt(n)||i("'")?a+=t.charAt(n):o=!1;else switch(t.charAt(n)){case"d":a+=r("d",e.getDate(),2);break;case"D":a+=s("D",e.getDay(),p,c);break;case"o":a+=r("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":a+=r("m",e.getMonth()+1,2);break;case"M":a+=s("M",e.getMonth(),h,d);break;case"y":a+=i("y")?e.getFullYear():(e.getFullYear()%100<10?"0":"")+e.getFullYear()%100;break;case"@":a+=e.getTime();break;case"!":a+=1e4*e.getTime()+this.ticksTo1970;break;case"'":i("'")?a+="'":o=!0;break;default:a+=t.charAt(n)}return a}},{key:"formatTime",value:function(e){if(!e)return"";var t="",n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),s=e.getMilliseconds();return"12"===this.props.hourFormat&&n>11&&12!==n&&(n-=12),t+="12"===this.props.hourFormat&&0===n?12:n<10?"0"+n:n,t+=":",t+=i<10?"0"+i:i,this.props.showSeconds&&(t+=":",t+=r<10?"0"+r:r),this.props.showMillisec&&(t+=".",t+=s<100?(s<10?"00":"0")+s:s),"12"===this.props.hourFormat&&(t+=e.getHours()>11?" PM":" AM"),t}},{key:"parseValueFromString",value:function(e){if(!e||0===e.trim().length)return null;var t;if(this.isSingleSelection())t=this.parseDateTime(e);else if(this.isMultipleSelection()){t=[];var n,i=P(e.split(","));try{for(i.s();!(n=i.n()).done;){t.push(this.parseDateTime(n.value.trim()))}}catch(e){i.e(e)}finally{i.f()}}else if(this.isRangeSelection()){var r=e.split(" - ");t=[];for(var s=0;s<r.length;s++)t[s]=this.parseDateTime(r[s].trim())}return t}},{key:"parseDateTime",value:function(e){var t,n=e.split(" ");return this.props.timeOnly?(t=new Date,this.populateTime(t,n[0],n[1])):this.props.showTime?(t=this.parseDate(n[0],this.getDateFormat()),this.populateTime(t,n[1],n[2])):t=this.parseDate(e,this.getDateFormat()),t}},{key:"populateTime",value:function(e,t,n){if("12"===this.props.hourFormat&&"PM"!==n&&"AM"!==n)throw new Error("Invalid Time");var i=this.parseTime(t,n);e.setHours(i.hour),e.setMinutes(i.minute),e.setSeconds(i.second),e.setMilliseconds(i.millisecond)}},{key:"parseTime",value:function(e,t){var n=(e=this.props.showMillisec?e.replace(".",":"):e).split(":"),i=this.props.showSeconds?3:2;if(n.length!==(i=this.props.showMillisec?i+1:i)||2!==n[0].length||2!==n[1].length||this.props.showSeconds&&2!==n[2].length||this.props.showMillisec&&3!==n[3].length)throw new Error("Invalid time");var r=parseInt(n[0],10),s=parseInt(n[1],10),a=this.props.showSeconds?parseInt(n[2],10):null,o=this.props.showMillisec?parseInt(n[3],10):null;if(isNaN(r)||isNaN(s)||r>23||s>59||"12"===this.props.hourFormat&&r>12||this.props.showSeconds&&(isNaN(a)||a>59)||this.props.showMillisec&&(isNaN(a)||a>1e3))throw new Error("Invalid time");return"12"===this.props.hourFormat&&12!==r&&"PM"===t&&(r+=12),{hour:r,minute:s,second:a,millisecond:o}}},{key:"parseDate",value:function(e,t){if(null==t||null==e)throw new Error("Invalid arguments");if(""===(e="object"===f(e)?e.toString():e+""))return null;var n,i,r,s,a=0,o="string"!=typeof this.props.shortYearCutoff?this.props.shortYearCutoff:(new Date).getFullYear()%100+parseInt(this.props.shortYearCutoff,10),l=-1,p=-1,c=-1,h=-1,d=!1,m=function(e){var i=n+1<t.length&&t.charAt(n+1)===e;return i&&n++,i},v=function(t){var n=m(t),i="@"===t?14:"!"===t?20:"y"===t&&n?4:"o"===t?3:2,r=new RegExp("^\\d{"+("y"===t?i:1)+","+i+"}"),s=e.substring(a).match(r);if(!s)throw new Error("Missing number at position "+a);return a+=s[0].length,parseInt(s[0],10)},g=function(t,n,i){for(var r=-1,s=m(t)?i:n,o=[],l=0;l<s.length;l++)o.push([l,s[l]]);o.sort((function(e,t){return-(e[1].length-t[1].length)}));for(var u=0;u<o.length;u++){var p=o[u][1];if(e.substr(a,p.length).toLowerCase()===p.toLowerCase()){r=o[u][0],a+=p.length;break}}if(-1!==r)return r+1;throw new Error("Unknown name at position "+a)},y=function(){if(e.charAt(a)!==t.charAt(n))throw new Error("Unexpected literal at position "+a);a++};"month"===this.props.view&&(c=1);var D=u.localeOptions(this.props.locale),k=D.dayNamesShort,M=D.dayNames,b=D.monthNamesShort,w=D.monthNames;for(n=0;n<t.length;n++)if(d)"'"!==t.charAt(n)||m("'")?y():d=!1;else switch(t.charAt(n)){case"d":c=v("d");break;case"D":g("D",k,M);break;case"o":h=v("o");break;case"m":p=v("m");break;case"M":p=g("M",b,w);break;case"y":l=v("y");break;case"@":l=(s=new Date(v("@"))).getFullYear(),p=s.getMonth()+1,c=s.getDate();break;case"!":l=(s=new Date((v("!")-this.ticksTo1970)/1e4)).getFullYear(),p=s.getMonth()+1,c=s.getDate();break;case"'":m("'")?y():d=!0;break;default:y()}if(a<e.length&&(r=e.substr(a),!/^\s+/.test(r)))throw new Error("Extra/unparsed characters found in date: "+r);if(-1===l?l=(new Date).getFullYear():l<100&&(l+=(new Date).getFullYear()-(new Date).getFullYear()%100+(l<=o?0:-100)),h>-1)for(p=1,c=h;;){if(c<=(i=this.getDaysCountInMonth(l,p-1)))break;p++,c-=i}if((s=this.daylightSavingAdjust(new Date(l,p-1,c))).getFullYear()!==l||s.getMonth()+1!==p||s.getDate()!==c)throw new Error("Invalid date");return s}},{key:"renderBackwardNavigator",value:function(e){var t=this;return h.default.createElement("button",m({type:"button",className:"p-datepicker-prev p-link"},e?{onClick:this.onPrevButtonClick,onKeyDown:function(e){return t.onContainerButtonKeydown(e)}}:{style:{visibility:"hidden"}}),h.default.createElement("span",{className:"p-datepicker-prev-icon pi pi-chevron-left"}),h.default.createElement(l.Ripple,null))}},{key:"renderForwardNavigator",value:function(e){var t=this;return h.default.createElement("button",m({type:"button",className:"p-datepicker-next p-link"},e?{onClick:this.onNextButtonClick,onKeyDown:function(e){return t.onContainerButtonKeydown(e)}}:{style:{visibility:"hidden"}}),h.default.createElement("span",{className:"p-datepicker-next-icon pi pi-chevron-right"}),h.default.createElement(l.Ripple,null))}},{key:"isInMinYear",value:function(e){return this.props.minDate&&this.props.minDate.getFullYear()===e.getFullYear()}},{key:"isInMaxYear",value:function(e){return this.props.maxDate&&this.props.maxDate.getFullYear()===e.getFullYear()}},{key:"renderTitleMonthElement",value:function(e){var t=this,n=u.localeOption("monthNames",this.props.locale);if(this.props.monthNavigator&&"month"!==this.props.view){var i=this.getViewDate(),r=i.getMonth(),s=n.map((function(e,n){return(!t.isInMinYear(i)||n>=t.props.minDate.getMonth())&&(!t.isInMaxYear(i)||n<=t.props.maxDate.getMonth())?{label:e,value:n,index:n}:null})).filter((function(e){return!!e})),o=s.map((function(e){return e.label})),l=h.default.createElement("select",{className:"p-datepicker-month",onChange:function(e){return t.onMonthDropdownChange(e,e.target.value)},value:r},s.map((function(e){return h.default.createElement("option",{key:e.label,value:e.value},e.label)})));return this.props.monthNavigatorTemplate?a.ObjectUtils.getJSXElement(this.props.monthNavigatorTemplate,{onChange:this.onMonthDropdownChange,className:"p-datepicker-month",value:r,names:o,options:s,element:l,props:this.props}):l}return h.default.createElement("span",{className:"p-datepicker-month"},n[e])}},{key:"renderTitleYearElement",value:function(e){var t=this;if(this.props.yearNavigator){for(var n=[],i=this.props.yearRange.split(":"),r=parseInt(i[0],10),s=parseInt(i[1],10),o=r;o<=s;o++)n.push(o);var l=this.getViewDate().getFullYear(),u=n.filter((function(e){return!(t.props.minDate&&t.props.minDate.getFullYear()>e||t.props.maxDate&&t.props.maxDate.getFullYear()<e)})),p=h.default.createElement("select",{className:"p-datepicker-year",onChange:function(e){return t.onYearDropdownChange(e,e.target.value)},value:l},u.map((function(e){return h.default.createElement("option",{key:e,value:e},e)})));if(this.props.yearNavigatorTemplate){var c=u.map((function(e,t){return{label:e,value:e,index:t}}));return a.ObjectUtils.getJSXElement(this.props.yearNavigatorTemplate,{onChange:this.onYearDropdownChange,className:"p-datepicker-year",value:l,names:u,options:c,element:p,props:this.props})}return p}return h.default.createElement("span",{className:"p-datepicker-year"},e)}},{key:"renderTitle",value:function(e){var t=this.renderTitleMonthElement(e.month),n=this.renderTitleYearElement(e.year);return h.default.createElement("div",{className:"p-datepicker-title"},t,n)}},{key:"renderDayNames",value:function(e){var t=e.map((function(e,t){return h.default.createElement("th",{key:"".concat(e,"-").concat(t),scope:"col"},h.default.createElement("span",null,e))}));return this.props.showWeek?[h.default.createElement("th",{scope:"col",key:"wn",className:"p-datepicker-weekheader p-disabled"},h.default.createElement("span",null,u.localeOption("weekHeader",this.props.locale)))].concat(M(t)):t}},{key:"renderDateCellContent",value:function(e,t,n){var i=this,r=this.props.dateTemplate?this.props.dateTemplate(e):e.day;return h.default.createElement("span",{className:t,onClick:function(t){return i.onDateSelect(t,e)},onKeyDown:function(t){return i.onDateCellKeydown(t,e,n)}},r,h.default.createElement(l.Ripple,null))}},{key:"renderWeek",value:function(e,t,n){var i=this,r=e.map((function(e){var t=i.isSelected(e),r=a.classNames({"p-datepicker-other-month":e.otherMonth,"p-datepicker-today":e.today}),s=a.classNames({"p-highlight":t,"p-disabled":!e.selectable}),o=e.otherMonth&&!i.props.showOtherMonths?null:i.renderDateCellContent(e,s,n);return h.default.createElement("td",{key:e.day,className:r},o)}));return this.props.showWeek?[h.default.createElement("td",{key:"wn"+t,className:"p-datepicker-weeknumber"},h.default.createElement("span",{className:"p-disabled"},t))].concat(M(r)):r}},{key:"renderDates",value:function(e,t){var n=this;return e.dates.map((function(i,r){return h.default.createElement("tr",{key:r},n.renderWeek(i,e.weekNumbers[r],t))}))}},{key:"renderDateViewGrid",value:function(e,t,n){var i=this.renderDayNames(t),r=this.renderDates(e,n);return h.default.createElement("div",{className:"p-datepicker-calendar-container"},h.default.createElement("table",{className:"p-datepicker-calendar"},h.default.createElement("thead",null,h.default.createElement("tr",null,i)),h.default.createElement("tbody",null,r)))}},{key:"renderMonth",value:function(e,t){var n=this.createWeekDays(),i=this.renderBackwardNavigator(0===t),r=this.renderForwardNavigator(1===this.props.numberOfMonths||t===this.props.numberOfMonths-1),s=this.renderTitle(e),a=this.renderDateViewGrid(e,n,t),o=this.props.headerTemplate?this.props.headerTemplate():null;return h.default.createElement("div",{key:e.month,className:"p-datepicker-group"},h.default.createElement("div",{className:"p-datepicker-header"},o,i,s,r),a)}},{key:"renderMonths",value:function(e){var t=this,n=e.map((function(e,n){return t.renderMonth(e,n)}));return h.default.createElement("div",{className:"p-datepicker-group-container"},n)}},{key:"renderDateView",value:function(){var e=this.getViewDate(),t=this.createMonths(e.getMonth(),e.getFullYear()),n=this.renderMonths(t);return h.default.createElement(h.default.Fragment,null,n)}},{key:"renderMonthViewMonth",value:function(e){var t=this,n=a.classNames("p-monthpicker-month",{"p-highlight":this.isMonthSelected(e)}),i=u.localeOption("monthNamesShort",this.props.locale)[e];return h.default.createElement("span",{key:i,className:n,onClick:function(n){return t.onMonthSelect(n,e)},onKeyDown:function(n){return t.onMonthCellKeydown(n,e)}},i,h.default.createElement(l.Ripple,null))}},{key:"renderMonthViewMonths",value:function(){for(var e=[],t=0;t<=11;t++)e.push(this.renderMonthViewMonth(t));return e}},{key:"renderMonthView",value:function(){var e=this.renderBackwardNavigator(!0),t=this.renderForwardNavigator(!0),n=this.renderTitleYearElement(this.getViewDate().getFullYear()),i=this.renderMonthViewMonths();return h.default.createElement(h.default.Fragment,null,h.default.createElement("div",{className:"p-datepicker-group-container"},h.default.createElement("div",{className:"p-datepicker-group"},h.default.createElement("div",{className:"p-datepicker-header"},e,h.default.createElement("div",{className:"p-datepicker-title"},n),t))),h.default.createElement("div",{className:"p-monthpicker"},i))}},{key:"renderDatePicker",value:function(){if(!this.props.timeOnly)return"date"===this.props.view?this.renderDateView():"month"===this.props.view?this.renderMonthView():null}},{key:"renderHourPicker",value:function(){var e=this,t=this.getCurrentDateTime().getHours();"12"===this.props.hourFormat&&(0===t?t=12:t>11&&12!==t&&(t-=12));var n=t<10?"0"+t:t;return h.default.createElement("div",{className:"p-hour-picker"},h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,0,1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-up"}),h.default.createElement(l.Ripple,null)),h.default.createElement("span",null,n),h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,0,-1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-down"}),h.default.createElement(l.Ripple,null)))}},{key:"renderMinutePicker",value:function(){var e=this,t=this.getCurrentDateTime().getMinutes(),n=t<10?"0"+t:t;return h.default.createElement("div",{className:"p-minute-picker"},h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,1,1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-up"}),h.default.createElement(l.Ripple,null)),h.default.createElement("span",null,n),h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,1,-1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-down"}),h.default.createElement(l.Ripple,null)))}},{key:"renderSecondPicker",value:function(){var e=this;if(this.props.showSeconds){var t=this.getCurrentDateTime().getSeconds(),n=t<10?"0"+t:t;return h.default.createElement("div",{className:"p-second-picker"},h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,2,1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-up"}),h.default.createElement(l.Ripple,null)),h.default.createElement("span",null,n),h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,2,-1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-down"}),h.default.createElement(l.Ripple,null)))}return null}},{key:"renderMiliSecondPicker",value:function(){var e=this;if(this.props.showMillisec){var t=this.getCurrentDateTime().getMilliseconds(),n=t<100?(t<10?"00":"0")+t:t;return h.default.createElement("div",{className:"p-millisecond-picker"},h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,3,1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-up"}),h.default.createElement(l.Ripple,null)),h.default.createElement("span",null,n),h.default.createElement("button",{type:"button",className:"p-link",onMouseDown:function(t){return e.onTimePickerElementMouseDown(t,3,-1)},onMouseUp:this.onTimePickerElementMouseUp,onMouseLeave:this.onTimePickerElementMouseLeave,onKeyDown:function(t){return e.onContainerButtonKeydown(t)}},h.default.createElement("span",{className:"pi pi-chevron-down"}),h.default.createElement(l.Ripple,null)))}return null}},{key:"renderAmPmPicker",value:function(){if("12"===this.props.hourFormat){var e=this.getCurrentDateTime().getHours()>11?"PM":"AM";return h.default.createElement("div",{className:"p-ampm-picker"},h.default.createElement("button",{type:"button",className:"p-link",onClick:this.toggleAmPm},h.default.createElement("span",{className:"pi pi-chevron-up"}),h.default.createElement(l.Ripple,null)),h.default.createElement("span",null,e),h.default.createElement("button",{type:"button",className:"p-link",onClick:this.toggleAmPm},h.default.createElement("span",{className:"pi pi-chevron-down"}),h.default.createElement(l.Ripple,null)))}return null}},{key:"renderSeparator",value:function(e){return h.default.createElement("div",{className:"p-separator"},h.default.createElement("span",null,e))}},{key:"renderTimePicker",value:function(){return this.props.showTime||this.props.timeOnly?h.default.createElement("div",{className:"p-timepicker"},this.renderHourPicker(),this.renderSeparator(":"),this.renderMinutePicker(),this.props.showSeconds&&this.renderSeparator(":"),this.renderSecondPicker(),this.props.showMillisec&&this.renderSeparator("."),this.renderMiliSecondPicker(),"12"===this.props.hourFormat&&this.renderSeparator(":"),this.renderAmPmPicker()):null}},{key:"renderInputElement",value:function(){return this.props.inline?null:h.default.createElement(n.InputText,{ref:this.inputRef,id:this.props.inputId,name:this.props.name,type:"text",className:this.props.inputClassName,style:this.props.inputStyle,readOnly:this.props.readOnlyInput,disabled:this.props.disabled,required:this.props.required,autoComplete:"off",placeholder:this.props.placeholder,tabIndex:this.props.tabIndex,onInput:this.onUserInput,onFocus:this.onInputFocus,onBlur:this.onInputBlur,onKeyDown:this.onInputKeyDown,"aria-labelledby":this.props.ariaLabelledBy,inputMode:this.props.inputMode})}},{key:"renderButton",value:function(){return this.props.showIcon?h.default.createElement(i.Button,{type:"button",icon:this.props.icon,onClick:this.onButtonClick,tabIndex:"-1",disabled:this.props.disabled,className:"p-datepicker-trigger"}):null}},{key:"renderContent",value:function(){var e=this.renderInputElement(),t=this.renderButton();return"left"===this.props.iconPos?h.default.createElement(h.default.Fragment,null,t,e):h.default.createElement(h.default.Fragment,null,e,t)}},{key:"renderButtonBar",value:function(){var e=this;if(this.props.showButtonBar){var t=a.classNames("p-button-text",this.props.todayButtonClassName),n=a.classNames("p-button-text",this.props.clearButtonClassName),r=u.localeOptions(this.props.locale),s=r.clear;return h.default.createElement("div",{className:"p-datepicker-buttonbar"},h.default.createElement(i.Button,{type:"button",label:r.today,onClick:this.onTodayButtonClick,onKeyDown:function(t){return e.onContainerButtonKeydown(t)},className:t}),h.default.createElement(i.Button,{type:"button",label:s,onClick:this.onClearButtonClick,onKeyDown:function(t){return e.onContainerButtonKeydown(t)},className:n}))}return null}},{key:"renderFooter",value:function(){if(this.props.footerTemplate){var e=this.props.footerTemplate();return h.default.createElement("div",{className:"p-datepicker-footer"},e)}return null}},{key:"render",value:function(){var e,t=this,n=a.classNames("p-calendar p-component p-inputwrapper",this.props.className,(O(e={},"p-calendar-w-btn p-calendar-w-btn-".concat(this.props.iconPos),this.props.showIcon),O(e,"p-calendar-disabled",this.props.disabled),O(e,"p-calendar-timeonly",this.props.timeOnly),O(e,"p-inputwrapper-filled",this.props.value||a.DomHandler.hasClass(this.inputRef.current,"p-filled")&&""!==this.inputRef.current.value),O(e,"p-inputwrapper-focus",this.state.focused),e)),i=a.classNames("p-datepicker p-component",this.props.panelClassName,{"p-datepicker-inline":this.props.inline,"p-disabled":this.props.disabled,"p-datepicker-timeonly":this.props.timeOnly,"p-datepicker-multiple-month":this.props.numberOfMonths>1,"p-datepicker-monthpicker":"month"===this.props.view,"p-datepicker-touch-ui":this.props.touchUI}),r=this.renderContent(),s=this.renderDatePicker(),o=this.renderTimePicker(),l=this.renderButtonBar(),u=this.renderFooter(),p=this.props.inline||this.isVisible();return h.default.createElement("span",{ref:function(e){return t.container=e},id:this.props.id,className:n,style:this.props.style},r,h.default.createElement(H,{ref:this.overlayRef,className:i,style:this.props.panelStyle,appendTo:this.props.appendTo,inline:this.props.inline,onClick:this.onPanelClick,onMouseUp:this.onPanelMouseUp,in:p,onEnter:this.onOverlayEnter,onEntered:this.onOverlayEntered,onExit:this.onOverlayExit,onExited:this.onOverlayExited,transitionOptions:this.props.transitionOptions},s,o,l,u))}}]),v}(t.Component);return O(L,"defaultProps",{id:null,inputRef:null,name:null,value:null,visible:!1,viewDate:null,style:null,className:null,inline:!1,selectionMode:"single",inputId:null,inputStyle:null,inputClassName:null,inputMode:"none",required:!1,readOnlyInput:!1,keepInvalid:!1,mask:null,disabled:!1,tabIndex:null,placeholder:null,showIcon:!1,icon:"pi pi-calendar",iconPos:"right",showOnFocus:!0,numberOfMonths:1,view:"date",touchUI:!1,showTime:!1,timeOnly:!1,showSeconds:!1,showMillisec:!1,hourFormat:"24",stepHour:1,stepMinute:1,stepSecond:1,stepMillisec:1,shortYearCutoff:"+10",hideOnDateTimeSelect:!1,showWeek:!1,locale:null,dateFormat:null,panelStyle:null,panelClassName:null,monthNavigator:!1,yearNavigator:!1,yearRange:null,disabledDates:null,disabledDays:null,minDate:null,maxDate:null,maxDateCount:null,showOtherMonths:!0,selectOtherMonths:!1,showButtonBar:!1,todayButtonClassName:"p-button-secondary",clearButtonClassName:"p-button-secondary",autoZIndex:!0,baseZIndex:0,appendTo:null,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,dateTemplate:null,headerTemplate:null,footerTemplate:null,monthNavigatorTemplate:null,yearNavigatorTemplate:null,transitionOptions:null,onVisibleChange:null,onFocus:null,onBlur:null,onInput:null,onSelect:null,onChange:null,onViewDateChange:null,onTodayButtonClick:null,onClearButtonClick:null,onShow:null,onHide:null}),e.Calendar=L,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.inputtext,primereact.button,primereact.csstransition,primereact.portal,primereact.utils,primereact.tooltip,primereact.ripple,primereact.api,primereact.overlayservice);
|
package/carousel/carousel.cjs.js
CHANGED
|
@@ -383,8 +383,8 @@ var Carousel = /*#__PURE__*/function (_Component2) {
|
|
|
383
383
|
}
|
|
384
384
|
}, {
|
|
385
385
|
key: "onTransitionEnd",
|
|
386
|
-
value: function onTransitionEnd() {
|
|
387
|
-
if (this.itemsContainer) {
|
|
386
|
+
value: function onTransitionEnd(e) {
|
|
387
|
+
if (this.itemsContainer && e.propertyName === 'transform') {
|
|
388
388
|
utils.DomHandler.addClass(this.itemsContainer, 'p-items-hidden');
|
|
389
389
|
this.itemsContainer.style.transition = '';
|
|
390
390
|
|
|
@@ -503,8 +503,7 @@ var Carousel = /*#__PURE__*/function (_Component2) {
|
|
|
503
503
|
key: "createStyle",
|
|
504
504
|
value: function createStyle() {
|
|
505
505
|
if (!this.carouselStyle) {
|
|
506
|
-
this.carouselStyle =
|
|
507
|
-
document.body.appendChild(this.carouselStyle);
|
|
506
|
+
this.carouselStyle = utils.DomHandler.createInlineStyle();
|
|
508
507
|
}
|
|
509
508
|
|
|
510
509
|
var innerHTML = "\n .p-carousel[".concat(this.attributeSelector, "] .p-carousel-item {\n flex: 1 0 ").concat(100 / this.state.numVisible, "%\n }\n ");
|
|
@@ -747,16 +746,16 @@ var Carousel = /*#__PURE__*/function (_Component2) {
|
|
|
747
746
|
className: "p-carousel-items-content",
|
|
748
747
|
style: {
|
|
749
748
|
'height': height
|
|
750
|
-
}
|
|
749
|
+
},
|
|
750
|
+
onTouchStart: this.onTouchStart,
|
|
751
|
+
onTouchMove: this.onTouchMove,
|
|
752
|
+
onTouchEnd: this.onTouchEnd
|
|
751
753
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
752
754
|
ref: function ref(el) {
|
|
753
755
|
return _this5.itemsContainer = el;
|
|
754
756
|
},
|
|
755
757
|
className: "p-carousel-items-container",
|
|
756
|
-
onTransitionEnd: this.onTransitionEnd
|
|
757
|
-
onTouchStart: this.onTouchStart,
|
|
758
|
-
onTouchMove: this.onTouchMove,
|
|
759
|
-
onTouchEnd: this.onTouchEnd
|
|
758
|
+
onTransitionEnd: this.onTransitionEnd
|
|
760
759
|
}, items)), forwardNavigator);
|
|
761
760
|
}
|
|
762
761
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("primereact/utils"),i=require("primereact/ripple");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=n(t);function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function r(t){if(Array.isArray(t))return a(t)}function o(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function l(t,e){if(t){if("string"==typeof t)return a(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,e):void 0}}function u(){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 c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function m(t,e,i){return e&&h(t.prototype,e),i&&h(t,i),t}function d(t,e){return d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},d(t,e)}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function g(t,e){if(e&&("object"===v(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return c(t)}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}function b(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function S(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function I(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?S(Object(i),!0).forEach((function(e){b(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):S(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function k(t){var e=w();return function(){var i,n=y(t);if(e){var s=y(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return g(this,i)}}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(t){return!1}}var P=function(i){f(a,t.Component);var n=k(a);function a(){return p(this,a),n.apply(this,arguments)}return m(a,[{key:"render",value:function(){var t=this.props.template(this.props.item),i=e.classNames(this.props.className,"p-carousel-item",{"p-carousel-item-active":this.props.active,"p-carousel-item-start":this.props.start,"p-carousel-item-end":this.props.end});return s.default.createElement("div",{className:i},t)}}]),a}();b(P,"defaultProps",{template:null,item:null,active:!1,start:!1,end:!1,className:null});var C=function(n){f(h,t.Component);var a=k(h);function h(t){var i;return p(this,h),(i=a.call(this,t)).state={numVisible:t.numVisible,numScroll:t.numScroll,totalShiftedItems:t.page*t.numScroll*-1},i.props.onPageChange||(i.state=I(I({},i.state),{},{page:t.page})),i.navBackward=i.navBackward.bind(c(i)),i.navForward=i.navForward.bind(c(i)),i.onTransitionEnd=i.onTransitionEnd.bind(c(i)),i.onTouchStart=i.onTouchStart.bind(c(i)),i.onTouchMove=i.onTouchMove.bind(c(i)),i.onTouchEnd=i.onTouchEnd.bind(c(i)),i.totalIndicators=0,i.remainingItems=0,i.allowAutoplay=!!i.props.autoplayInterval,i.circular=i.props.circular||i.allowAutoplay,i.attributeSelector=e.UniqueComponentId(),i.swipeThreshold=20,i}return m(h,[{key:"step",value:function(t,i){var n=this.state.totalShiftedItems,s=this.isCircular();null!=i?(n=this.state.numScroll*i*-1,s&&(n-=this.state.numVisible),this.isRemainingItemsAdded=!1):(n+=this.state.numScroll*t,this.isRemainingItemsAdded&&(n+=this.remainingItems-this.state.numScroll*t,this.isRemainingItemsAdded=!1),i=Math.abs(Math.floor((s?n+this.state.numVisible:n)/this.state.numScroll)));s&&this.state.page===this.totalIndicators-1&&-1===t?(n=-1*(this.props.value.length+this.state.numVisible),i=0):s&&0===this.state.page&&1===t?(n=0,i=this.totalIndicators-1):i===this.totalIndicators-1&&this.remainingItems>0&&(n+=-1*this.remainingItems-this.state.numScroll*t,this.isRemainingItemsAdded=!0),this.itemsContainer&&(e.DomHandler.removeClass(this.itemsContainer,"p-items-hidden"),this.changePosition(n),this.itemsContainer.style.transition="transform 500ms ease 0s"),this.props.onPageChange?(this.setState({totalShiftedItems:n}),this.props.onPageChange({page:i})):this.setState({page:i,totalShiftedItems:n})}},{key:"calculatePosition",value:function(){if(this.itemsContainer&&this.responsiveOptions){for(var t=window.innerWidth,e={numVisible:this.props.numVisible,numScroll:this.props.numScroll},i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];parseInt(n.breakpoint,10)>=t&&(e=n)}var s={};if(this.state.numScroll!==e.numScroll){var a=this.getPage();a=Math.floor(a*this.state.numScroll/e.numScroll);var r=e.numScroll*a*-1;this.isCircular()&&(r-=e.numVisible),s={totalShiftedItems:r,numScroll:e.numScroll},this.props.onPageChange?this.props.onPageChange({page:a}):s=I(I({},s),{},{page:a})}this.state.numVisible!==e.numVisible&&(s=I(I({},s),{},{numVisible:e.numVisible})),Object.keys(s).length&&this.setState(s)}}},{key:"navBackward",value:function(t,e){(this.circular||0!==this.getPage())&&this.step(1,e),this.allowAutoplay=!1,t.cancelable&&t.preventDefault()}},{key:"navForward",value:function(t,e){(this.circular||this.getPage()<this.totalIndicators-1)&&this.step(-1,e),this.allowAutoplay=!1,t.cancelable&&t.preventDefault()}},{key:"onDotClick",value:function(t,e){var i=this.getPage();e>i?this.navForward(t,e):e<i&&this.navBackward(t,e)}},{key:"onTransitionEnd",value:function(){this.itemsContainer&&(e.DomHandler.addClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="",0!==this.state.page&&this.state.page!==this.totalIndicators-1||!this.isCircular()||this.changePosition(this.state.totalShiftedItems))}},{key:"onTouchStart",value:function(t){var e=t.changedTouches[0];this.startPos={x:e.pageX,y:e.pageY}}},{key:"onTouchMove",value:function(t){t.cancelable&&t.preventDefault()}},{key:"onTouchEnd",value:function(t){var e=t.changedTouches[0];this.isVertical()?this.changePageOnTouch(t,e.pageY-this.startPos.y):this.changePageOnTouch(t,e.pageX-this.startPos.x)}},{key:"changePageOnTouch",value:function(t,e){Math.abs(e)>this.swipeThreshold&&(e<0?this.navForward(t):this.navBackward(t))}},{key:"bindDocumentListeners",value:function(){var t=this;this.documentResizeListener||(this.documentResizeListener=function(){t.calculatePosition()},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentListeners",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"isVertical",value:function(){return"vertical"===this.props.orientation}},{key:"isCircular",value:function(){return this.circular&&this.props.value.length>=this.state.numVisible}},{key:"getPage",value:function(){return this.props.onPageChange?this.props.page:this.state.page}},{key:"getTotalIndicators",value:function(){return this.props.value?Math.ceil((this.props.value.length-this.state.numVisible)/this.state.numScroll)+1:0}},{key:"isAutoplay",value:function(){return this.props.autoplayInterval&&this.allowAutoplay}},{key:"startAutoplay",value:function(){var t=this;this.interval=setInterval((function(){t.step(-1,t.state.page===t.totalIndicators-1?0:t.state.page+1)}),this.props.autoplayInterval)}},{key:"stopAutoplay",value:function(){this.interval&&clearInterval(this.interval)}},{key:"createStyle",value:function(){this.carouselStyle||(this.carouselStyle=document.createElement("style"),document.body.appendChild(this.carouselStyle));var t,e="\n .p-carousel[".concat(this.attributeSelector,"] .p-carousel-item {\n flex: 1 0 ").concat(100/this.state.numVisible,"%\n }\n ");if(this.props.responsiveOptions){this.responsiveOptions=r(t=this.props.responsiveOptions)||o(t)||l(t)||u(),this.responsiveOptions.sort((function(t,e){var i=t.breakpoint,n=e.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 i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];e+="\n @media screen and (max-width: ".concat(n.breakpoint,") {\n .p-carousel[").concat(this.attributeSelector,"] .p-carousel-item {\n flex: 1 0 ").concat(100/n.numVisible,"%\n }\n }\n ")}}this.carouselStyle.innerHTML=e}},{key:"changePosition",value:function(t){this.itemsContainer&&(this.itemsContainer.style.transform=this.isVertical()?"translate3d(0, ".concat(t*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(t*(100/this.state.numVisible),"%, 0, 0)"))}},{key:"componentDidMount",value:function(){this.container&&this.container.setAttribute(this.attributeSelector,""),this.createStyle(),this.calculatePosition(),this.changePosition(this.state.totalShiftedItems),this.props.responsiveOptions&&this.bindDocumentListeners()}},{key:"componentDidUpdate",value:function(t,e){var i=this.isCircular(),n=!1,s=this.state.totalShiftedItems;if(this.props.autoplayInterval&&this.stopAutoplay(),e.numScroll!==this.state.numScroll||e.numVisible!==this.state.numVisible||this.props.value&&t.value&&t.value.length!==this.props.value.length){this.remainingItems=(this.props.value.length-this.state.numVisible)%this.state.numScroll;var a=this.getPage();0!==this.totalIndicators&&a>=this.totalIndicators&&(a=this.totalIndicators-1,this.props.onPageChange?this.props.onPageChange({page:a}):this.setState({page:a}),n=!0),s=a*this.state.numScroll*-1,i&&(s-=this.state.numVisible),a===this.totalIndicators-1&&this.remainingItems>0?(s+=-1*this.remainingItems+this.state.numScroll,this.isRemainingItemsAdded=!0):this.isRemainingItemsAdded=!1,s!==this.state.totalShiftedItems&&(this.setState({totalShiftedItems:s}),n=!0),this.changePosition(s)}i&&(0===this.state.page?s=-1*this.state.numVisible:0===s&&(s=-1*this.props.value.length,this.remainingItems>0&&(this.isRemainingItemsAdded=!0)),s!==this.state.totalShiftedItems&&(this.setState({totalShiftedItems:s}),n=!0)),t.page!==this.props.page&&(this.props.page>t.page&&this.props.page<=this.totalIndicators-1?this.step(-1,this.props.page):this.props.page<t.page&&this.step(1,this.props.page)),!n&&this.isAutoplay()&&this.startAutoplay()}},{key:"componentWillUnmount",value:function(){this.props.responsiveOptions&&this.unbindDocumentListeners(),this.props.autoplayInterval&&this.stopAutoplay()}},{key:"renderItems",value:function(){var t=this;if(this.props.value&&this.props.value.length){var e=this.isCircular(),i=null,n=null;if(e){var a=null;i=(a=this.props.value.slice(-1*this.state.numVisible)).map((function(e,i){return s.default.createElement(P,{key:i+"_scloned",className:"p-carousel-item-cloned",template:t.props.itemTemplate,item:e,active:-1*t.state.totalShiftedItems===t.props.value.length+t.state.numVisible,start:0===i,end:i===a.length-1})})),n=(a=this.props.value.slice(0,this.state.numVisible)).map((function(e,i){return s.default.createElement(P,{key:i+"_fcloned",className:"p-carousel-item-cloned",template:t.props.itemTemplate,item:e,active:0===t.state.totalShiftedItems,start:0===i,end:i===a.length-1})}))}var r=this.props.value.map((function(i,n){var a=e?-1*(t.state.totalShiftedItems+t.state.numVisible):-1*t.state.totalShiftedItems,r=a+t.state.numVisible-1;return s.default.createElement(P,{key:n,template:t.props.itemTemplate,item:i,active:a<=n&&r>=n,start:a===n,end:r===n})}));return s.default.createElement(s.default.Fragment,null,i,r,n)}}},{key:"renderHeader",value:function(){return this.props.header?s.default.createElement("div",{className:"p-carousel-header"},this.props.header):null}},{key:"renderFooter",value:function(){return this.props.footer?s.default.createElement("div",{className:"p-carousel-footer"},this.props.footer):null}},{key:"renderContent",value:function(){var t=this,i=this.renderItems(),n=this.isVertical()?this.props.verticalViewPortHeight:"auto",a=this.renderBackwardNavigator(),r=this.renderForwardNavigator(),o=e.classNames("p-carousel-container",this.props.containerClassName);return s.default.createElement("div",{className:o},a,s.default.createElement("div",{className:"p-carousel-items-content",style:{height:n}},s.default.createElement("div",{ref:function(e){return t.itemsContainer=e},className:"p-carousel-items-container",onTransitionEnd:this.onTransitionEnd,onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd},i)),r)}},{key:"renderBackwardNavigator",value:function(){var t=(!this.circular||this.props.value&&this.props.value.length<this.state.numVisible)&&0===this.getPage(),n=e.classNames("p-carousel-prev p-link",{"p-disabled":t}),a=e.classNames("p-carousel-prev-icon pi",{"pi-chevron-left":!this.isVertical(),"pi-chevron-up":this.isVertical()});return s.default.createElement("button",{type:"button",className:n,onClick:this.navBackward,disabled:t},s.default.createElement("span",{className:a}),s.default.createElement(i.Ripple,null))}},{key:"renderForwardNavigator",value:function(){var t=(!this.circular||this.props.value&&this.props.value.length<this.state.numVisible)&&(this.getPage()===this.totalIndicators-1||0===this.totalIndicators),n=e.classNames("p-carousel-next p-link",{"p-disabled":t}),a=e.classNames("p-carousel-next-icon pi",{"pi-chevron-right":!this.isVertical(),"pi-chevron-down":this.isVertical()});return s.default.createElement("button",{type:"button",className:n,onClick:this.navForward,disabled:t},s.default.createElement("span",{className:a}),s.default.createElement(i.Ripple,null))}},{key:"renderIndicator",value:function(t){var n=this,a=this.getPage()===t,r=e.classNames("p-carousel-indicator",{"p-highlight":a});return s.default.createElement("li",{className:r,key:"p-carousel-indicator-"+t},s.default.createElement("button",{type:"button",className:"p-link",onClick:function(e){return n.onDotClick(e,t)}},s.default.createElement(i.Ripple,null)))}},{key:"renderIndicators",value:function(){for(var t=e.classNames("p-carousel-indicators p-reset",this.props.indicatorsContentClassName),i=[],n=0;n<this.totalIndicators;n++)i.push(this.renderIndicator(n));return s.default.createElement("ul",{className:t},i)}},{key:"render",value:function(){var t=this,i=e.classNames("p-carousel p-component",{"p-carousel-vertical":this.isVertical(),"p-carousel-horizontal":!this.isVertical()},this.props.className),n=e.classNames("p-carousel-content",this.props.contentClassName);this.totalIndicators=this.getTotalIndicators();var a=this.renderContent(),r=this.renderIndicators(),o=this.renderHeader(),l=this.renderFooter();return s.default.createElement("div",{ref:function(e){return t.container=e},id:this.props.id,className:i,style:this.props.style},o,s.default.createElement("div",{className:n},a,r),l)}}]),h}();b(C,"defaultProps",{id:null,value:null,page:0,header:null,footer:null,style:null,className:null,itemTemplate:null,circular:!1,autoplayInterval:0,numVisible:1,numScroll:1,responsiveOptions:null,orientation:"horizontal",verticalViewPortHeight:"300px",contentClassName:null,containerClassName:null,indicatorsContentClassName:null,onPageChange:null}),exports.Carousel=C;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("primereact/utils"),i=require("primereact/ripple");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=n(t);function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function r(t){if(Array.isArray(t))return a(t)}function o(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function l(t,e){if(t){if("string"==typeof t)return a(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,e):void 0}}function u(){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 c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function m(t,e,i){return e&&h(t.prototype,e),i&&h(t,i),t}function d(t,e){return d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},d(t,e)}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function g(t,e){if(e&&("object"===v(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return c(t)}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}function b(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function S(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function I(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?S(Object(i),!0).forEach((function(e){b(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):S(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function k(t){var e=w();return function(){var i,n=y(t);if(e){var s=y(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return g(this,i)}}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(t){return!1}}var P=function(i){f(a,t.Component);var n=k(a);function a(){return p(this,a),n.apply(this,arguments)}return m(a,[{key:"render",value:function(){var t=this.props.template(this.props.item),i=e.classNames(this.props.className,"p-carousel-item",{"p-carousel-item-active":this.props.active,"p-carousel-item-start":this.props.start,"p-carousel-item-end":this.props.end});return s.default.createElement("div",{className:i},t)}}]),a}();b(P,"defaultProps",{template:null,item:null,active:!1,start:!1,end:!1,className:null});var C=function(n){f(h,t.Component);var a=k(h);function h(t){var i;return p(this,h),(i=a.call(this,t)).state={numVisible:t.numVisible,numScroll:t.numScroll,totalShiftedItems:t.page*t.numScroll*-1},i.props.onPageChange||(i.state=I(I({},i.state),{},{page:t.page})),i.navBackward=i.navBackward.bind(c(i)),i.navForward=i.navForward.bind(c(i)),i.onTransitionEnd=i.onTransitionEnd.bind(c(i)),i.onTouchStart=i.onTouchStart.bind(c(i)),i.onTouchMove=i.onTouchMove.bind(c(i)),i.onTouchEnd=i.onTouchEnd.bind(c(i)),i.totalIndicators=0,i.remainingItems=0,i.allowAutoplay=!!i.props.autoplayInterval,i.circular=i.props.circular||i.allowAutoplay,i.attributeSelector=e.UniqueComponentId(),i.swipeThreshold=20,i}return m(h,[{key:"step",value:function(t,i){var n=this.state.totalShiftedItems,s=this.isCircular();null!=i?(n=this.state.numScroll*i*-1,s&&(n-=this.state.numVisible),this.isRemainingItemsAdded=!1):(n+=this.state.numScroll*t,this.isRemainingItemsAdded&&(n+=this.remainingItems-this.state.numScroll*t,this.isRemainingItemsAdded=!1),i=Math.abs(Math.floor((s?n+this.state.numVisible:n)/this.state.numScroll)));s&&this.state.page===this.totalIndicators-1&&-1===t?(n=-1*(this.props.value.length+this.state.numVisible),i=0):s&&0===this.state.page&&1===t?(n=0,i=this.totalIndicators-1):i===this.totalIndicators-1&&this.remainingItems>0&&(n+=-1*this.remainingItems-this.state.numScroll*t,this.isRemainingItemsAdded=!0),this.itemsContainer&&(e.DomHandler.removeClass(this.itemsContainer,"p-items-hidden"),this.changePosition(n),this.itemsContainer.style.transition="transform 500ms ease 0s"),this.props.onPageChange?(this.setState({totalShiftedItems:n}),this.props.onPageChange({page:i})):this.setState({page:i,totalShiftedItems:n})}},{key:"calculatePosition",value:function(){if(this.itemsContainer&&this.responsiveOptions){for(var t=window.innerWidth,e={numVisible:this.props.numVisible,numScroll:this.props.numScroll},i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];parseInt(n.breakpoint,10)>=t&&(e=n)}var s={};if(this.state.numScroll!==e.numScroll){var a=this.getPage();a=Math.floor(a*this.state.numScroll/e.numScroll);var r=e.numScroll*a*-1;this.isCircular()&&(r-=e.numVisible),s={totalShiftedItems:r,numScroll:e.numScroll},this.props.onPageChange?this.props.onPageChange({page:a}):s=I(I({},s),{},{page:a})}this.state.numVisible!==e.numVisible&&(s=I(I({},s),{},{numVisible:e.numVisible})),Object.keys(s).length&&this.setState(s)}}},{key:"navBackward",value:function(t,e){(this.circular||0!==this.getPage())&&this.step(1,e),this.allowAutoplay=!1,t.cancelable&&t.preventDefault()}},{key:"navForward",value:function(t,e){(this.circular||this.getPage()<this.totalIndicators-1)&&this.step(-1,e),this.allowAutoplay=!1,t.cancelable&&t.preventDefault()}},{key:"onDotClick",value:function(t,e){var i=this.getPage();e>i?this.navForward(t,e):e<i&&this.navBackward(t,e)}},{key:"onTransitionEnd",value:function(t){this.itemsContainer&&"transform"===t.propertyName&&(e.DomHandler.addClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="",0!==this.state.page&&this.state.page!==this.totalIndicators-1||!this.isCircular()||this.changePosition(this.state.totalShiftedItems))}},{key:"onTouchStart",value:function(t){var e=t.changedTouches[0];this.startPos={x:e.pageX,y:e.pageY}}},{key:"onTouchMove",value:function(t){t.cancelable&&t.preventDefault()}},{key:"onTouchEnd",value:function(t){var e=t.changedTouches[0];this.isVertical()?this.changePageOnTouch(t,e.pageY-this.startPos.y):this.changePageOnTouch(t,e.pageX-this.startPos.x)}},{key:"changePageOnTouch",value:function(t,e){Math.abs(e)>this.swipeThreshold&&(e<0?this.navForward(t):this.navBackward(t))}},{key:"bindDocumentListeners",value:function(){var t=this;this.documentResizeListener||(this.documentResizeListener=function(){t.calculatePosition()},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentListeners",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"isVertical",value:function(){return"vertical"===this.props.orientation}},{key:"isCircular",value:function(){return this.circular&&this.props.value.length>=this.state.numVisible}},{key:"getPage",value:function(){return this.props.onPageChange?this.props.page:this.state.page}},{key:"getTotalIndicators",value:function(){return this.props.value?Math.ceil((this.props.value.length-this.state.numVisible)/this.state.numScroll)+1:0}},{key:"isAutoplay",value:function(){return this.props.autoplayInterval&&this.allowAutoplay}},{key:"startAutoplay",value:function(){var t=this;this.interval=setInterval((function(){t.step(-1,t.state.page===t.totalIndicators-1?0:t.state.page+1)}),this.props.autoplayInterval)}},{key:"stopAutoplay",value:function(){this.interval&&clearInterval(this.interval)}},{key:"createStyle",value:function(){this.carouselStyle||(this.carouselStyle=e.DomHandler.createInlineStyle());var t,i="\n .p-carousel[".concat(this.attributeSelector,"] .p-carousel-item {\n flex: 1 0 ").concat(100/this.state.numVisible,"%\n }\n ");if(this.props.responsiveOptions){this.responsiveOptions=r(t=this.props.responsiveOptions)||o(t)||l(t)||u(),this.responsiveOptions.sort((function(t,e){var i=t.breakpoint,n=e.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-carousel[").concat(this.attributeSelector,"] .p-carousel-item {\n flex: 1 0 ").concat(100/s.numVisible,"%\n }\n }\n ")}}this.carouselStyle.innerHTML=i}},{key:"changePosition",value:function(t){this.itemsContainer&&(this.itemsContainer.style.transform=this.isVertical()?"translate3d(0, ".concat(t*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(t*(100/this.state.numVisible),"%, 0, 0)"))}},{key:"componentDidMount",value:function(){this.container&&this.container.setAttribute(this.attributeSelector,""),this.createStyle(),this.calculatePosition(),this.changePosition(this.state.totalShiftedItems),this.props.responsiveOptions&&this.bindDocumentListeners()}},{key:"componentDidUpdate",value:function(t,e){var i=this.isCircular(),n=!1,s=this.state.totalShiftedItems;if(this.props.autoplayInterval&&this.stopAutoplay(),e.numScroll!==this.state.numScroll||e.numVisible!==this.state.numVisible||this.props.value&&t.value&&t.value.length!==this.props.value.length){this.remainingItems=(this.props.value.length-this.state.numVisible)%this.state.numScroll;var a=this.getPage();0!==this.totalIndicators&&a>=this.totalIndicators&&(a=this.totalIndicators-1,this.props.onPageChange?this.props.onPageChange({page:a}):this.setState({page:a}),n=!0),s=a*this.state.numScroll*-1,i&&(s-=this.state.numVisible),a===this.totalIndicators-1&&this.remainingItems>0?(s+=-1*this.remainingItems+this.state.numScroll,this.isRemainingItemsAdded=!0):this.isRemainingItemsAdded=!1,s!==this.state.totalShiftedItems&&(this.setState({totalShiftedItems:s}),n=!0),this.changePosition(s)}i&&(0===this.state.page?s=-1*this.state.numVisible:0===s&&(s=-1*this.props.value.length,this.remainingItems>0&&(this.isRemainingItemsAdded=!0)),s!==this.state.totalShiftedItems&&(this.setState({totalShiftedItems:s}),n=!0)),t.page!==this.props.page&&(this.props.page>t.page&&this.props.page<=this.totalIndicators-1?this.step(-1,this.props.page):this.props.page<t.page&&this.step(1,this.props.page)),!n&&this.isAutoplay()&&this.startAutoplay()}},{key:"componentWillUnmount",value:function(){this.props.responsiveOptions&&this.unbindDocumentListeners(),this.props.autoplayInterval&&this.stopAutoplay()}},{key:"renderItems",value:function(){var t=this;if(this.props.value&&this.props.value.length){var e=this.isCircular(),i=null,n=null;if(e){var a=null;i=(a=this.props.value.slice(-1*this.state.numVisible)).map((function(e,i){return s.default.createElement(P,{key:i+"_scloned",className:"p-carousel-item-cloned",template:t.props.itemTemplate,item:e,active:-1*t.state.totalShiftedItems===t.props.value.length+t.state.numVisible,start:0===i,end:i===a.length-1})})),n=(a=this.props.value.slice(0,this.state.numVisible)).map((function(e,i){return s.default.createElement(P,{key:i+"_fcloned",className:"p-carousel-item-cloned",template:t.props.itemTemplate,item:e,active:0===t.state.totalShiftedItems,start:0===i,end:i===a.length-1})}))}var r=this.props.value.map((function(i,n){var a=e?-1*(t.state.totalShiftedItems+t.state.numVisible):-1*t.state.totalShiftedItems,r=a+t.state.numVisible-1;return s.default.createElement(P,{key:n,template:t.props.itemTemplate,item:i,active:a<=n&&r>=n,start:a===n,end:r===n})}));return s.default.createElement(s.default.Fragment,null,i,r,n)}}},{key:"renderHeader",value:function(){return this.props.header?s.default.createElement("div",{className:"p-carousel-header"},this.props.header):null}},{key:"renderFooter",value:function(){return this.props.footer?s.default.createElement("div",{className:"p-carousel-footer"},this.props.footer):null}},{key:"renderContent",value:function(){var t=this,i=this.renderItems(),n=this.isVertical()?this.props.verticalViewPortHeight:"auto",a=this.renderBackwardNavigator(),r=this.renderForwardNavigator(),o=e.classNames("p-carousel-container",this.props.containerClassName);return s.default.createElement("div",{className:o},a,s.default.createElement("div",{className:"p-carousel-items-content",style:{height:n},onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd},s.default.createElement("div",{ref:function(e){return t.itemsContainer=e},className:"p-carousel-items-container",onTransitionEnd:this.onTransitionEnd},i)),r)}},{key:"renderBackwardNavigator",value:function(){var t=(!this.circular||this.props.value&&this.props.value.length<this.state.numVisible)&&0===this.getPage(),n=e.classNames("p-carousel-prev p-link",{"p-disabled":t}),a=e.classNames("p-carousel-prev-icon pi",{"pi-chevron-left":!this.isVertical(),"pi-chevron-up":this.isVertical()});return s.default.createElement("button",{type:"button",className:n,onClick:this.navBackward,disabled:t},s.default.createElement("span",{className:a}),s.default.createElement(i.Ripple,null))}},{key:"renderForwardNavigator",value:function(){var t=(!this.circular||this.props.value&&this.props.value.length<this.state.numVisible)&&(this.getPage()===this.totalIndicators-1||0===this.totalIndicators),n=e.classNames("p-carousel-next p-link",{"p-disabled":t}),a=e.classNames("p-carousel-next-icon pi",{"pi-chevron-right":!this.isVertical(),"pi-chevron-down":this.isVertical()});return s.default.createElement("button",{type:"button",className:n,onClick:this.navForward,disabled:t},s.default.createElement("span",{className:a}),s.default.createElement(i.Ripple,null))}},{key:"renderIndicator",value:function(t){var n=this,a=this.getPage()===t,r=e.classNames("p-carousel-indicator",{"p-highlight":a});return s.default.createElement("li",{className:r,key:"p-carousel-indicator-"+t},s.default.createElement("button",{type:"button",className:"p-link",onClick:function(e){return n.onDotClick(e,t)}},s.default.createElement(i.Ripple,null)))}},{key:"renderIndicators",value:function(){for(var t=e.classNames("p-carousel-indicators p-reset",this.props.indicatorsContentClassName),i=[],n=0;n<this.totalIndicators;n++)i.push(this.renderIndicator(n));return s.default.createElement("ul",{className:t},i)}},{key:"render",value:function(){var t=this,i=e.classNames("p-carousel p-component",{"p-carousel-vertical":this.isVertical(),"p-carousel-horizontal":!this.isVertical()},this.props.className),n=e.classNames("p-carousel-content",this.props.contentClassName);this.totalIndicators=this.getTotalIndicators();var a=this.renderContent(),r=this.renderIndicators(),o=this.renderHeader(),l=this.renderFooter();return s.default.createElement("div",{ref:function(e){return t.container=e},id:this.props.id,className:i,style:this.props.style},o,s.default.createElement("div",{className:n},a,r),l)}}]),h}();b(C,"defaultProps",{id:null,value:null,page:0,header:null,footer:null,style:null,className:null,itemTemplate:null,circular:!1,autoplayInterval:0,numVisible:1,numScroll:1,responsiveOptions:null,orientation:"horizontal",verticalViewPortHeight:"300px",contentClassName:null,containerClassName:null,indicatorsContentClassName:null,onPageChange:null}),exports.Carousel=C;
|
package/carousel/carousel.esm.js
CHANGED
|
@@ -375,8 +375,8 @@ var Carousel = /*#__PURE__*/function (_Component2) {
|
|
|
375
375
|
}
|
|
376
376
|
}, {
|
|
377
377
|
key: "onTransitionEnd",
|
|
378
|
-
value: function onTransitionEnd() {
|
|
379
|
-
if (this.itemsContainer) {
|
|
378
|
+
value: function onTransitionEnd(e) {
|
|
379
|
+
if (this.itemsContainer && e.propertyName === 'transform') {
|
|
380
380
|
DomHandler.addClass(this.itemsContainer, 'p-items-hidden');
|
|
381
381
|
this.itemsContainer.style.transition = '';
|
|
382
382
|
|
|
@@ -495,8 +495,7 @@ var Carousel = /*#__PURE__*/function (_Component2) {
|
|
|
495
495
|
key: "createStyle",
|
|
496
496
|
value: function createStyle() {
|
|
497
497
|
if (!this.carouselStyle) {
|
|
498
|
-
this.carouselStyle =
|
|
499
|
-
document.body.appendChild(this.carouselStyle);
|
|
498
|
+
this.carouselStyle = DomHandler.createInlineStyle();
|
|
500
499
|
}
|
|
501
500
|
|
|
502
501
|
var innerHTML = "\n .p-carousel[".concat(this.attributeSelector, "] .p-carousel-item {\n flex: 1 0 ").concat(100 / this.state.numVisible, "%\n }\n ");
|
|
@@ -739,16 +738,16 @@ var Carousel = /*#__PURE__*/function (_Component2) {
|
|
|
739
738
|
className: "p-carousel-items-content",
|
|
740
739
|
style: {
|
|
741
740
|
'height': height
|
|
742
|
-
}
|
|
741
|
+
},
|
|
742
|
+
onTouchStart: this.onTouchStart,
|
|
743
|
+
onTouchMove: this.onTouchMove,
|
|
744
|
+
onTouchEnd: this.onTouchEnd
|
|
743
745
|
}, /*#__PURE__*/React.createElement("div", {
|
|
744
746
|
ref: function ref(el) {
|
|
745
747
|
return _this5.itemsContainer = el;
|
|
746
748
|
},
|
|
747
749
|
className: "p-carousel-items-container",
|
|
748
|
-
onTransitionEnd: this.onTransitionEnd
|
|
749
|
-
onTouchStart: this.onTouchStart,
|
|
750
|
-
onTouchMove: this.onTouchMove,
|
|
751
|
-
onTouchEnd: this.onTouchEnd
|
|
750
|
+
onTransitionEnd: this.onTransitionEnd
|
|
752
751
|
}, items)), forwardNavigator);
|
|
753
752
|
}
|
|
754
753
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t,{Component as e}from"react";import{classNames as i,UniqueComponentId as n,DomHandler as s}from"primereact/utils";import{Ripple as r}from"primereact/ripple";function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function o(t){if(Array.isArray(t))return a(t)}function l(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function c(t,e){if(t){if("string"==typeof t)return a(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,e):void 0}}function u(){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 h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function d(t,e,i){return e&&m(t.prototype,e),i&&m(t,i),t}function v(t,e){return v=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},v(t,e)}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&v(t,e)}function g(t){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(t)}function y(t,e){if(e&&("object"===g(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return h(t)}function b(t){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},b(t)}function S(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function I(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function k(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?I(Object(i),!0).forEach((function(e){S(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):I(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function w(t){var e=P();return function(){var i,n=b(t);if(e){var s=b(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return y(this,i)}}function P(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var O=function(n){f(r,e);var s=w(r);function r(){return p(this,r),s.apply(this,arguments)}return d(r,[{key:"render",value:function(){var e=this.props.template(this.props.item),n=i(this.props.className,"p-carousel-item",{"p-carousel-item-active":this.props.active,"p-carousel-item-start":this.props.start,"p-carousel-item-end":this.props.end});return t.createElement("div",{className:n},e)}}]),r}();S(O,"defaultProps",{template:null,item:null,active:!1,start:!1,end:!1,className:null});var C=function(a){f(v,e);var m=w(v);function v(t){var e;return p(this,v),(e=m.call(this,t)).state={numVisible:t.numVisible,numScroll:t.numScroll,totalShiftedItems:t.page*t.numScroll*-1},e.props.onPageChange||(e.state=k(k({},e.state),{},{page:t.page})),e.navBackward=e.navBackward.bind(h(e)),e.navForward=e.navForward.bind(h(e)),e.onTransitionEnd=e.onTransitionEnd.bind(h(e)),e.onTouchStart=e.onTouchStart.bind(h(e)),e.onTouchMove=e.onTouchMove.bind(h(e)),e.onTouchEnd=e.onTouchEnd.bind(h(e)),e.totalIndicators=0,e.remainingItems=0,e.allowAutoplay=!!e.props.autoplayInterval,e.circular=e.props.circular||e.allowAutoplay,e.attributeSelector=n(),e.swipeThreshold=20,e}return d(v,[{key:"step",value:function(t,e){var i=this.state.totalShiftedItems,n=this.isCircular();null!=e?(i=this.state.numScroll*e*-1,n&&(i-=this.state.numVisible),this.isRemainingItemsAdded=!1):(i+=this.state.numScroll*t,this.isRemainingItemsAdded&&(i+=this.remainingItems-this.state.numScroll*t,this.isRemainingItemsAdded=!1),e=Math.abs(Math.floor((n?i+this.state.numVisible:i)/this.state.numScroll)));n&&this.state.page===this.totalIndicators-1&&-1===t?(i=-1*(this.props.value.length+this.state.numVisible),e=0):n&&0===this.state.page&&1===t?(i=0,e=this.totalIndicators-1):e===this.totalIndicators-1&&this.remainingItems>0&&(i+=-1*this.remainingItems-this.state.numScroll*t,this.isRemainingItemsAdded=!0),this.itemsContainer&&(s.removeClass(this.itemsContainer,"p-items-hidden"),this.changePosition(i),this.itemsContainer.style.transition="transform 500ms ease 0s"),this.props.onPageChange?(this.setState({totalShiftedItems:i}),this.props.onPageChange({page:e})):this.setState({page:e,totalShiftedItems:i})}},{key:"calculatePosition",value:function(){if(this.itemsContainer&&this.responsiveOptions){for(var t=window.innerWidth,e={numVisible:this.props.numVisible,numScroll:this.props.numScroll},i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];parseInt(n.breakpoint,10)>=t&&(e=n)}var s={};if(this.state.numScroll!==e.numScroll){var r=this.getPage();r=Math.floor(r*this.state.numScroll/e.numScroll);var a=e.numScroll*r*-1;this.isCircular()&&(a-=e.numVisible),s={totalShiftedItems:a,numScroll:e.numScroll},this.props.onPageChange?this.props.onPageChange({page:r}):s=k(k({},s),{},{page:r})}this.state.numVisible!==e.numVisible&&(s=k(k({},s),{},{numVisible:e.numVisible})),Object.keys(s).length&&this.setState(s)}}},{key:"navBackward",value:function(t,e){(this.circular||0!==this.getPage())&&this.step(1,e),this.allowAutoplay=!1,t.cancelable&&t.preventDefault()}},{key:"navForward",value:function(t,e){(this.circular||this.getPage()<this.totalIndicators-1)&&this.step(-1,e),this.allowAutoplay=!1,t.cancelable&&t.preventDefault()}},{key:"onDotClick",value:function(t,e){var i=this.getPage();e>i?this.navForward(t,e):e<i&&this.navBackward(t,e)}},{key:"onTransitionEnd",value:function(){this.itemsContainer&&(s.addClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="",0!==this.state.page&&this.state.page!==this.totalIndicators-1||!this.isCircular()||this.changePosition(this.state.totalShiftedItems))}},{key:"onTouchStart",value:function(t){var e=t.changedTouches[0];this.startPos={x:e.pageX,y:e.pageY}}},{key:"onTouchMove",value:function(t){t.cancelable&&t.preventDefault()}},{key:"onTouchEnd",value:function(t){var e=t.changedTouches[0];this.isVertical()?this.changePageOnTouch(t,e.pageY-this.startPos.y):this.changePageOnTouch(t,e.pageX-this.startPos.x)}},{key:"changePageOnTouch",value:function(t,e){Math.abs(e)>this.swipeThreshold&&(e<0?this.navForward(t):this.navBackward(t))}},{key:"bindDocumentListeners",value:function(){var t=this;this.documentResizeListener||(this.documentResizeListener=function(){t.calculatePosition()},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentListeners",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"isVertical",value:function(){return"vertical"===this.props.orientation}},{key:"isCircular",value:function(){return this.circular&&this.props.value.length>=this.state.numVisible}},{key:"getPage",value:function(){return this.props.onPageChange?this.props.page:this.state.page}},{key:"getTotalIndicators",value:function(){return this.props.value?Math.ceil((this.props.value.length-this.state.numVisible)/this.state.numScroll)+1:0}},{key:"isAutoplay",value:function(){return this.props.autoplayInterval&&this.allowAutoplay}},{key:"startAutoplay",value:function(){var t=this;this.interval=setInterval((function(){t.step(-1,t.state.page===t.totalIndicators-1?0:t.state.page+1)}),this.props.autoplayInterval)}},{key:"stopAutoplay",value:function(){this.interval&&clearInterval(this.interval)}},{key:"createStyle",value:function(){this.carouselStyle||(this.carouselStyle=document.createElement("style"),document.body.appendChild(this.carouselStyle));var t,e="\n .p-carousel[".concat(this.attributeSelector,"] .p-carousel-item {\n flex: 1 0 ").concat(100/this.state.numVisible,"%\n }\n ");if(this.props.responsiveOptions){this.responsiveOptions=o(t=this.props.responsiveOptions)||l(t)||c(t)||u(),this.responsiveOptions.sort((function(t,e){var i=t.breakpoint,n=e.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 i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];e+="\n @media screen and (max-width: ".concat(n.breakpoint,") {\n .p-carousel[").concat(this.attributeSelector,"] .p-carousel-item {\n flex: 1 0 ").concat(100/n.numVisible,"%\n }\n }\n ")}}this.carouselStyle.innerHTML=e}},{key:"changePosition",value:function(t){this.itemsContainer&&(this.itemsContainer.style.transform=this.isVertical()?"translate3d(0, ".concat(t*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(t*(100/this.state.numVisible),"%, 0, 0)"))}},{key:"componentDidMount",value:function(){this.container&&this.container.setAttribute(this.attributeSelector,""),this.createStyle(),this.calculatePosition(),this.changePosition(this.state.totalShiftedItems),this.props.responsiveOptions&&this.bindDocumentListeners()}},{key:"componentDidUpdate",value:function(t,e){var i=this.isCircular(),n=!1,s=this.state.totalShiftedItems;if(this.props.autoplayInterval&&this.stopAutoplay(),e.numScroll!==this.state.numScroll||e.numVisible!==this.state.numVisible||this.props.value&&t.value&&t.value.length!==this.props.value.length){this.remainingItems=(this.props.value.length-this.state.numVisible)%this.state.numScroll;var r=this.getPage();0!==this.totalIndicators&&r>=this.totalIndicators&&(r=this.totalIndicators-1,this.props.onPageChange?this.props.onPageChange({page:r}):this.setState({page:r}),n=!0),s=r*this.state.numScroll*-1,i&&(s-=this.state.numVisible),r===this.totalIndicators-1&&this.remainingItems>0?(s+=-1*this.remainingItems+this.state.numScroll,this.isRemainingItemsAdded=!0):this.isRemainingItemsAdded=!1,s!==this.state.totalShiftedItems&&(this.setState({totalShiftedItems:s}),n=!0),this.changePosition(s)}i&&(0===this.state.page?s=-1*this.state.numVisible:0===s&&(s=-1*this.props.value.length,this.remainingItems>0&&(this.isRemainingItemsAdded=!0)),s!==this.state.totalShiftedItems&&(this.setState({totalShiftedItems:s}),n=!0)),t.page!==this.props.page&&(this.props.page>t.page&&this.props.page<=this.totalIndicators-1?this.step(-1,this.props.page):this.props.page<t.page&&this.step(1,this.props.page)),!n&&this.isAutoplay()&&this.startAutoplay()}},{key:"componentWillUnmount",value:function(){this.props.responsiveOptions&&this.unbindDocumentListeners(),this.props.autoplayInterval&&this.stopAutoplay()}},{key:"renderItems",value:function(){var e=this;if(this.props.value&&this.props.value.length){var i=this.isCircular(),n=null,s=null;if(i){var r=null;n=(r=this.props.value.slice(-1*this.state.numVisible)).map((function(i,n){return t.createElement(O,{key:n+"_scloned",className:"p-carousel-item-cloned",template:e.props.itemTemplate,item:i,active:-1*e.state.totalShiftedItems===e.props.value.length+e.state.numVisible,start:0===n,end:n===r.length-1})})),s=(r=this.props.value.slice(0,this.state.numVisible)).map((function(i,n){return t.createElement(O,{key:n+"_fcloned",className:"p-carousel-item-cloned",template:e.props.itemTemplate,item:i,active:0===e.state.totalShiftedItems,start:0===n,end:n===r.length-1})}))}var a=this.props.value.map((function(n,s){var r=i?-1*(e.state.totalShiftedItems+e.state.numVisible):-1*e.state.totalShiftedItems,a=r+e.state.numVisible-1;return t.createElement(O,{key:s,template:e.props.itemTemplate,item:n,active:r<=s&&a>=s,start:r===s,end:a===s})}));return t.createElement(t.Fragment,null,n,a,s)}}},{key:"renderHeader",value:function(){return this.props.header?t.createElement("div",{className:"p-carousel-header"},this.props.header):null}},{key:"renderFooter",value:function(){return this.props.footer?t.createElement("div",{className:"p-carousel-footer"},this.props.footer):null}},{key:"renderContent",value:function(){var e=this,n=this.renderItems(),s=this.isVertical()?this.props.verticalViewPortHeight:"auto",r=this.renderBackwardNavigator(),a=this.renderForwardNavigator(),o=i("p-carousel-container",this.props.containerClassName);return t.createElement("div",{className:o},r,t.createElement("div",{className:"p-carousel-items-content",style:{height:s}},t.createElement("div",{ref:function(t){return e.itemsContainer=t},className:"p-carousel-items-container",onTransitionEnd:this.onTransitionEnd,onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd},n)),a)}},{key:"renderBackwardNavigator",value:function(){var e=(!this.circular||this.props.value&&this.props.value.length<this.state.numVisible)&&0===this.getPage(),n=i("p-carousel-prev p-link",{"p-disabled":e}),s=i("p-carousel-prev-icon pi",{"pi-chevron-left":!this.isVertical(),"pi-chevron-up":this.isVertical()});return t.createElement("button",{type:"button",className:n,onClick:this.navBackward,disabled:e},t.createElement("span",{className:s}),t.createElement(r,null))}},{key:"renderForwardNavigator",value:function(){var e=(!this.circular||this.props.value&&this.props.value.length<this.state.numVisible)&&(this.getPage()===this.totalIndicators-1||0===this.totalIndicators),n=i("p-carousel-next p-link",{"p-disabled":e}),s=i("p-carousel-next-icon pi",{"pi-chevron-right":!this.isVertical(),"pi-chevron-down":this.isVertical()});return t.createElement("button",{type:"button",className:n,onClick:this.navForward,disabled:e},t.createElement("span",{className:s}),t.createElement(r,null))}},{key:"renderIndicator",value:function(e){var n=this,s=this.getPage()===e,a=i("p-carousel-indicator",{"p-highlight":s});return t.createElement("li",{className:a,key:"p-carousel-indicator-"+e},t.createElement("button",{type:"button",className:"p-link",onClick:function(t){return n.onDotClick(t,e)}},t.createElement(r,null)))}},{key:"renderIndicators",value:function(){for(var e=i("p-carousel-indicators p-reset",this.props.indicatorsContentClassName),n=[],s=0;s<this.totalIndicators;s++)n.push(this.renderIndicator(s));return t.createElement("ul",{className:e},n)}},{key:"render",value:function(){var e=this,n=i("p-carousel p-component",{"p-carousel-vertical":this.isVertical(),"p-carousel-horizontal":!this.isVertical()},this.props.className),s=i("p-carousel-content",this.props.contentClassName);this.totalIndicators=this.getTotalIndicators();var r=this.renderContent(),a=this.renderIndicators(),o=this.renderHeader(),l=this.renderFooter();return t.createElement("div",{ref:function(t){return e.container=t},id:this.props.id,className:n,style:this.props.style},o,t.createElement("div",{className:s},r,a),l)}}]),v}();S(C,"defaultProps",{id:null,value:null,page:0,header:null,footer:null,style:null,className:null,itemTemplate:null,circular:!1,autoplayInterval:0,numVisible:1,numScroll:1,responsiveOptions:null,orientation:"horizontal",verticalViewPortHeight:"300px",contentClassName:null,containerClassName:null,indicatorsContentClassName:null,onPageChange:null});export{C as Carousel};
|
|
1
|
+
import t,{Component as e}from"react";import{classNames as i,UniqueComponentId as n,DomHandler as s}from"primereact/utils";import{Ripple as r}from"primereact/ripple";function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function o(t){if(Array.isArray(t))return a(t)}function l(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function c(t,e){if(t){if("string"==typeof t)return a(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,e):void 0}}function u(){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 h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function d(t,e,i){return e&&m(t.prototype,e),i&&m(t,i),t}function f(t,e){return f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},f(t,e)}function v(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&f(t,e)}function g(t){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(t)}function y(t,e){if(e&&("object"===g(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return h(t)}function b(t){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},b(t)}function S(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function I(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function k(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?I(Object(i),!0).forEach((function(e){S(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):I(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function w(t){var e=P();return function(){var i,n=b(t);if(e){var s=b(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return y(this,i)}}function P(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var O=function(n){v(r,e);var s=w(r);function r(){return p(this,r),s.apply(this,arguments)}return d(r,[{key:"render",value:function(){var e=this.props.template(this.props.item),n=i(this.props.className,"p-carousel-item",{"p-carousel-item-active":this.props.active,"p-carousel-item-start":this.props.start,"p-carousel-item-end":this.props.end});return t.createElement("div",{className:n},e)}}]),r}();S(O,"defaultProps",{template:null,item:null,active:!1,start:!1,end:!1,className:null});var C=function(a){v(f,e);var m=w(f);function f(t){var e;return p(this,f),(e=m.call(this,t)).state={numVisible:t.numVisible,numScroll:t.numScroll,totalShiftedItems:t.page*t.numScroll*-1},e.props.onPageChange||(e.state=k(k({},e.state),{},{page:t.page})),e.navBackward=e.navBackward.bind(h(e)),e.navForward=e.navForward.bind(h(e)),e.onTransitionEnd=e.onTransitionEnd.bind(h(e)),e.onTouchStart=e.onTouchStart.bind(h(e)),e.onTouchMove=e.onTouchMove.bind(h(e)),e.onTouchEnd=e.onTouchEnd.bind(h(e)),e.totalIndicators=0,e.remainingItems=0,e.allowAutoplay=!!e.props.autoplayInterval,e.circular=e.props.circular||e.allowAutoplay,e.attributeSelector=n(),e.swipeThreshold=20,e}return d(f,[{key:"step",value:function(t,e){var i=this.state.totalShiftedItems,n=this.isCircular();null!=e?(i=this.state.numScroll*e*-1,n&&(i-=this.state.numVisible),this.isRemainingItemsAdded=!1):(i+=this.state.numScroll*t,this.isRemainingItemsAdded&&(i+=this.remainingItems-this.state.numScroll*t,this.isRemainingItemsAdded=!1),e=Math.abs(Math.floor((n?i+this.state.numVisible:i)/this.state.numScroll)));n&&this.state.page===this.totalIndicators-1&&-1===t?(i=-1*(this.props.value.length+this.state.numVisible),e=0):n&&0===this.state.page&&1===t?(i=0,e=this.totalIndicators-1):e===this.totalIndicators-1&&this.remainingItems>0&&(i+=-1*this.remainingItems-this.state.numScroll*t,this.isRemainingItemsAdded=!0),this.itemsContainer&&(s.removeClass(this.itemsContainer,"p-items-hidden"),this.changePosition(i),this.itemsContainer.style.transition="transform 500ms ease 0s"),this.props.onPageChange?(this.setState({totalShiftedItems:i}),this.props.onPageChange({page:e})):this.setState({page:e,totalShiftedItems:i})}},{key:"calculatePosition",value:function(){if(this.itemsContainer&&this.responsiveOptions){for(var t=window.innerWidth,e={numVisible:this.props.numVisible,numScroll:this.props.numScroll},i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];parseInt(n.breakpoint,10)>=t&&(e=n)}var s={};if(this.state.numScroll!==e.numScroll){var r=this.getPage();r=Math.floor(r*this.state.numScroll/e.numScroll);var a=e.numScroll*r*-1;this.isCircular()&&(a-=e.numVisible),s={totalShiftedItems:a,numScroll:e.numScroll},this.props.onPageChange?this.props.onPageChange({page:r}):s=k(k({},s),{},{page:r})}this.state.numVisible!==e.numVisible&&(s=k(k({},s),{},{numVisible:e.numVisible})),Object.keys(s).length&&this.setState(s)}}},{key:"navBackward",value:function(t,e){(this.circular||0!==this.getPage())&&this.step(1,e),this.allowAutoplay=!1,t.cancelable&&t.preventDefault()}},{key:"navForward",value:function(t,e){(this.circular||this.getPage()<this.totalIndicators-1)&&this.step(-1,e),this.allowAutoplay=!1,t.cancelable&&t.preventDefault()}},{key:"onDotClick",value:function(t,e){var i=this.getPage();e>i?this.navForward(t,e):e<i&&this.navBackward(t,e)}},{key:"onTransitionEnd",value:function(t){this.itemsContainer&&"transform"===t.propertyName&&(s.addClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="",0!==this.state.page&&this.state.page!==this.totalIndicators-1||!this.isCircular()||this.changePosition(this.state.totalShiftedItems))}},{key:"onTouchStart",value:function(t){var e=t.changedTouches[0];this.startPos={x:e.pageX,y:e.pageY}}},{key:"onTouchMove",value:function(t){t.cancelable&&t.preventDefault()}},{key:"onTouchEnd",value:function(t){var e=t.changedTouches[0];this.isVertical()?this.changePageOnTouch(t,e.pageY-this.startPos.y):this.changePageOnTouch(t,e.pageX-this.startPos.x)}},{key:"changePageOnTouch",value:function(t,e){Math.abs(e)>this.swipeThreshold&&(e<0?this.navForward(t):this.navBackward(t))}},{key:"bindDocumentListeners",value:function(){var t=this;this.documentResizeListener||(this.documentResizeListener=function(){t.calculatePosition()},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentListeners",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"isVertical",value:function(){return"vertical"===this.props.orientation}},{key:"isCircular",value:function(){return this.circular&&this.props.value.length>=this.state.numVisible}},{key:"getPage",value:function(){return this.props.onPageChange?this.props.page:this.state.page}},{key:"getTotalIndicators",value:function(){return this.props.value?Math.ceil((this.props.value.length-this.state.numVisible)/this.state.numScroll)+1:0}},{key:"isAutoplay",value:function(){return this.props.autoplayInterval&&this.allowAutoplay}},{key:"startAutoplay",value:function(){var t=this;this.interval=setInterval((function(){t.step(-1,t.state.page===t.totalIndicators-1?0:t.state.page+1)}),this.props.autoplayInterval)}},{key:"stopAutoplay",value:function(){this.interval&&clearInterval(this.interval)}},{key:"createStyle",value:function(){this.carouselStyle||(this.carouselStyle=s.createInlineStyle());var t,e="\n .p-carousel[".concat(this.attributeSelector,"] .p-carousel-item {\n flex: 1 0 ").concat(100/this.state.numVisible,"%\n }\n ");if(this.props.responsiveOptions){this.responsiveOptions=o(t=this.props.responsiveOptions)||l(t)||c(t)||u(),this.responsiveOptions.sort((function(t,e){var i=t.breakpoint,n=e.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 i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];e+="\n @media screen and (max-width: ".concat(n.breakpoint,") {\n .p-carousel[").concat(this.attributeSelector,"] .p-carousel-item {\n flex: 1 0 ").concat(100/n.numVisible,"%\n }\n }\n ")}}this.carouselStyle.innerHTML=e}},{key:"changePosition",value:function(t){this.itemsContainer&&(this.itemsContainer.style.transform=this.isVertical()?"translate3d(0, ".concat(t*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(t*(100/this.state.numVisible),"%, 0, 0)"))}},{key:"componentDidMount",value:function(){this.container&&this.container.setAttribute(this.attributeSelector,""),this.createStyle(),this.calculatePosition(),this.changePosition(this.state.totalShiftedItems),this.props.responsiveOptions&&this.bindDocumentListeners()}},{key:"componentDidUpdate",value:function(t,e){var i=this.isCircular(),n=!1,s=this.state.totalShiftedItems;if(this.props.autoplayInterval&&this.stopAutoplay(),e.numScroll!==this.state.numScroll||e.numVisible!==this.state.numVisible||this.props.value&&t.value&&t.value.length!==this.props.value.length){this.remainingItems=(this.props.value.length-this.state.numVisible)%this.state.numScroll;var r=this.getPage();0!==this.totalIndicators&&r>=this.totalIndicators&&(r=this.totalIndicators-1,this.props.onPageChange?this.props.onPageChange({page:r}):this.setState({page:r}),n=!0),s=r*this.state.numScroll*-1,i&&(s-=this.state.numVisible),r===this.totalIndicators-1&&this.remainingItems>0?(s+=-1*this.remainingItems+this.state.numScroll,this.isRemainingItemsAdded=!0):this.isRemainingItemsAdded=!1,s!==this.state.totalShiftedItems&&(this.setState({totalShiftedItems:s}),n=!0),this.changePosition(s)}i&&(0===this.state.page?s=-1*this.state.numVisible:0===s&&(s=-1*this.props.value.length,this.remainingItems>0&&(this.isRemainingItemsAdded=!0)),s!==this.state.totalShiftedItems&&(this.setState({totalShiftedItems:s}),n=!0)),t.page!==this.props.page&&(this.props.page>t.page&&this.props.page<=this.totalIndicators-1?this.step(-1,this.props.page):this.props.page<t.page&&this.step(1,this.props.page)),!n&&this.isAutoplay()&&this.startAutoplay()}},{key:"componentWillUnmount",value:function(){this.props.responsiveOptions&&this.unbindDocumentListeners(),this.props.autoplayInterval&&this.stopAutoplay()}},{key:"renderItems",value:function(){var e=this;if(this.props.value&&this.props.value.length){var i=this.isCircular(),n=null,s=null;if(i){var r=null;n=(r=this.props.value.slice(-1*this.state.numVisible)).map((function(i,n){return t.createElement(O,{key:n+"_scloned",className:"p-carousel-item-cloned",template:e.props.itemTemplate,item:i,active:-1*e.state.totalShiftedItems===e.props.value.length+e.state.numVisible,start:0===n,end:n===r.length-1})})),s=(r=this.props.value.slice(0,this.state.numVisible)).map((function(i,n){return t.createElement(O,{key:n+"_fcloned",className:"p-carousel-item-cloned",template:e.props.itemTemplate,item:i,active:0===e.state.totalShiftedItems,start:0===n,end:n===r.length-1})}))}var a=this.props.value.map((function(n,s){var r=i?-1*(e.state.totalShiftedItems+e.state.numVisible):-1*e.state.totalShiftedItems,a=r+e.state.numVisible-1;return t.createElement(O,{key:s,template:e.props.itemTemplate,item:n,active:r<=s&&a>=s,start:r===s,end:a===s})}));return t.createElement(t.Fragment,null,n,a,s)}}},{key:"renderHeader",value:function(){return this.props.header?t.createElement("div",{className:"p-carousel-header"},this.props.header):null}},{key:"renderFooter",value:function(){return this.props.footer?t.createElement("div",{className:"p-carousel-footer"},this.props.footer):null}},{key:"renderContent",value:function(){var e=this,n=this.renderItems(),s=this.isVertical()?this.props.verticalViewPortHeight:"auto",r=this.renderBackwardNavigator(),a=this.renderForwardNavigator(),o=i("p-carousel-container",this.props.containerClassName);return t.createElement("div",{className:o},r,t.createElement("div",{className:"p-carousel-items-content",style:{height:s},onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd},t.createElement("div",{ref:function(t){return e.itemsContainer=t},className:"p-carousel-items-container",onTransitionEnd:this.onTransitionEnd},n)),a)}},{key:"renderBackwardNavigator",value:function(){var e=(!this.circular||this.props.value&&this.props.value.length<this.state.numVisible)&&0===this.getPage(),n=i("p-carousel-prev p-link",{"p-disabled":e}),s=i("p-carousel-prev-icon pi",{"pi-chevron-left":!this.isVertical(),"pi-chevron-up":this.isVertical()});return t.createElement("button",{type:"button",className:n,onClick:this.navBackward,disabled:e},t.createElement("span",{className:s}),t.createElement(r,null))}},{key:"renderForwardNavigator",value:function(){var e=(!this.circular||this.props.value&&this.props.value.length<this.state.numVisible)&&(this.getPage()===this.totalIndicators-1||0===this.totalIndicators),n=i("p-carousel-next p-link",{"p-disabled":e}),s=i("p-carousel-next-icon pi",{"pi-chevron-right":!this.isVertical(),"pi-chevron-down":this.isVertical()});return t.createElement("button",{type:"button",className:n,onClick:this.navForward,disabled:e},t.createElement("span",{className:s}),t.createElement(r,null))}},{key:"renderIndicator",value:function(e){var n=this,s=this.getPage()===e,a=i("p-carousel-indicator",{"p-highlight":s});return t.createElement("li",{className:a,key:"p-carousel-indicator-"+e},t.createElement("button",{type:"button",className:"p-link",onClick:function(t){return n.onDotClick(t,e)}},t.createElement(r,null)))}},{key:"renderIndicators",value:function(){for(var e=i("p-carousel-indicators p-reset",this.props.indicatorsContentClassName),n=[],s=0;s<this.totalIndicators;s++)n.push(this.renderIndicator(s));return t.createElement("ul",{className:e},n)}},{key:"render",value:function(){var e=this,n=i("p-carousel p-component",{"p-carousel-vertical":this.isVertical(),"p-carousel-horizontal":!this.isVertical()},this.props.className),s=i("p-carousel-content",this.props.contentClassName);this.totalIndicators=this.getTotalIndicators();var r=this.renderContent(),a=this.renderIndicators(),o=this.renderHeader(),l=this.renderFooter();return t.createElement("div",{ref:function(t){return e.container=t},id:this.props.id,className:n,style:this.props.style},o,t.createElement("div",{className:s},r,a),l)}}]),f}();S(C,"defaultProps",{id:null,value:null,page:0,header:null,footer:null,style:null,className:null,itemTemplate:null,circular:!1,autoplayInterval:0,numVisible:1,numScroll:1,responsiveOptions:null,orientation:"horizontal",verticalViewPortHeight:"300px",contentClassName:null,containerClassName:null,indicatorsContentClassName:null,onPageChange:null});export{C as Carousel};
|