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
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.confirmpopup=function(e,t,n,i,r,o,s,c,l){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(t),p=a(n),f=a(s);function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(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 v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},y(e,t)}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}function b(e){return b="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},b(e)}function k(e,t){if(t&&("object"===b(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(){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}}function C(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 O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){L(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var R=function(e){m(L,e);var t,n,a,p,y,b=(t=L,n=j(),function(){var e,i=E(t);if(n){var r=E(this).constructor;e=Reflect.construct(i,arguments,r)}else e=i.apply(this,arguments);return k(this,e)});function L(e){var t;return d(this,L),(t=b.call(this,e)).state={visible:!1},t.reject=t.reject.bind(v(t)),t.accept=t.accept.bind(v(t)),t.hide=t.hide.bind(v(t)),t.onCloseClick=t.onCloseClick.bind(v(t)),t.onPanelClick=t.onPanelClick.bind(v(t)),t.onEnter=t.onEnter.bind(v(t)),t.onEntered=t.onEntered.bind(v(t)),t.onExit=t.onExit.bind(v(t)),t.onExited=t.onExited.bind(v(t)),t.overlayRef=u.default.createRef(),t.acceptBtnRef=u.default.createRef(),t}return a=L,(p=[{key:"acceptLabel",value:function(){return this.props.acceptLabel||s.localeOption("accept")}},{key:"rejectLabel",value:function(){return this.props.rejectLabel||s.localeOption("reject")}},{key:"bindDocumentClickListener",value:function(){var e=this;!this.documentClickListener&&this.props.dismissable&&(this.documentClickListener=function(t){!e.isPanelClicked&&e.isOutsideClicked(t.target)&&e.hide(),e.isPanelClicked=!1},document.addEventListener("click",this.documentClickListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new i.ConnectedOverlayScrollHandler(this.props.target,(function(){e.state.visible&&e.hide()}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"bindResizeListener",value:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.state.visible&&!i.DomHandler.isAndroid()&&e.hide()},window.addEventListener("resize",this.resizeListener))}},{key:"unbindResizeListener",value:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)}},{key:"isOutsideClicked",value:function(e){return this.overlayRef&&this.overlayRef.current&&!(this.overlayRef.current.isSameNode(e)||this.overlayRef.current.contains(e))}},{key:"onCloseClick",value:function(e){this.hide(),e.preventDefault()}},{key:"onPanelClick",value:function(e){this.isPanelClicked=!0,c.OverlayService.emit("overlay-click",{originalEvent:e,target:this.props.target})}},{key:"accept",value:function(){this.props.accept&&this.props.accept(),this.hide("accept")}},{key:"reject",value:function(){this.props.reject&&this.props.reject(),this.hide("reject")}},{key:"show",value:function(){var e=this;this.setState({visible:!0},(function(){e.overlayEventListener=function(t){e.isOutsideClicked(t.target)||(e.isPanelClicked=!0)},c.OverlayService.on("overlay-click",e.overlayEventListener)}))}},{key:"hide",value:function(e){var t=this;this.setState({visible:!1},(function(){c.OverlayService.off("overlay-click",t.overlayEventListener),t.overlayEventListener=null,t.props.onHide&&t.props.onHide(e)}))}},{key:"onEnter",value:function(){i.ZIndexUtils.set("overlay",this.overlayRef.current,f.default.autoZIndex,f.default.zIndex.overlay),this.align()}},{key:"onEntered",value:function(){this.bindDocumentClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.acceptBtnRef&&this.acceptBtnRef.current&&this.acceptBtnRef.current.focus(),this.props.onShow&&this.props.onShow()}},{key:"onExit",value:function(){this.unbindDocumentClickListener(),this.unbindScrollListener(),this.unbindResizeListener()}},{key:"onExited",value:function(){i.ZIndexUtils.clear(this.overlayRef.current)}},{key:"align",value:function(){if(this.props.target){i.DomHandler.absolutePosition(this.overlayRef.current,this.props.target);var e=i.DomHandler.getOffset(this.overlayRef.current),t=i.DomHandler.getOffset(this.props.target),n=0;e.left<t.left&&(n=t.left-e.left),this.overlayRef.current.style.setProperty("--overlayArrowLeft","".concat(n,"px")),e.top<t.top&&i.DomHandler.addClass(this.overlayRef.current,"p-confirm-popup-flipped")}}},{key:"componentDidMount",value:function(){this.props.visible&&this.setState({visible:!0})}},{key:"componentDidUpdate",value:function(e){e.visible!==this.props.visible&&this.setState({visible:this.props.visible})}},{key:"componentWillUnmount",value:function(){this.unbindDocumentClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.overlayEventListener&&(c.OverlayService.off("overlay-click",this.overlayEventListener),this.overlayEventListener=null),i.ZIndexUtils.clear(this.overlayRef.current)}},{key:"renderContent",value:function(){var e=i.ObjectUtils.getJSXElement(this.props.message,this.props);return u.default.createElement("div",{className:"p-confirm-popup-content"},i.IconUtils.getJSXIcon(this.props.icon,{className:"p-confirm-popup-icon"},{props:this.props}),u.default.createElement("span",{className:"p-confirm-popup-message"},e))}},{key:"renderFooter",value:function(){var e=i.classNames("p-confirm-popup-accept p-button-sm",this.props.acceptClassName),t=i.classNames("p-confirm-popup-reject p-button-sm",{"p-button-text":!this.props.rejectClassName},this.props.rejectClassName),n=u.default.createElement("div",{className:"p-confirm-popup-footer"},u.default.createElement(r.Button,{label:this.rejectLabel(),icon:this.props.rejectIcon,className:t,onClick:this.reject}),u.default.createElement(r.Button,{ref:this.acceptBtnRef,label:this.acceptLabel(),icon:this.props.acceptIcon,className:e,onClick:this.accept}));if(this.props.footer){var o={accept:this.accept,reject:this.reject,className:"p-confirm-popup-footer",acceptClassName:e,rejectClassName:t,acceptLabel:this.acceptLabel(),rejectLabel:this.rejectLabel(),element:n,props:this.props};return i.ObjectUtils.getJSXElement(this.props.footer,o)}return n}},{key:"renderElement",value:function(){var e=i.classNames("p-confirm-popup p-component",this.props.className),t=this.renderContent(),n=this.renderFooter();return u.default.createElement(o.CSSTransition,{nodeRef:this.overlayRef,classNames:"p-connected-overlay",in:this.state.visible,timeout:{enter:120,exit:100},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},u.default.createElement("div",{ref:this.overlayRef,id:this.props.id,className:e,style:this.props.style,onClick:this.onPanelClick},t,n))}},{key:"render",value:function(){var e=this.renderElement();return u.default.createElement(l.Portal,{element:e,appendTo:this.props.appendTo,visible:!0})}}])&&h(a.prototype,p),y&&h(a,y),L}(t.Component);return L(R,"defaultProps",{target:null,visible:!1,message:null,rejectLabel:null,acceptLabel:null,icon:null,rejectIcon:null,acceptIcon:null,rejectClassName:null,acceptClassName:null,className:null,style:null,appendTo:null,dismissable:!0,footer:null,onShow:null,onHide:null,accept:null,reject:null,transitionOptions:null}),e.ConfirmPopup=R,e.confirmPopup=function(e){var t=e.appendTo||document.body,n=document.createDocumentFragment();i.DomHandler.appendChild(n,t),e=O(O({},e),{visible:void 0===e.visible||e.visible});var r=u.default.createElement(R,e);p.default.render(r,n);var o=function(t){e=O(O({},e),t),p.default.render(u.default.cloneElement(r,e),n)};return{_destroy:function(){p.default.unmountComponentAtNode(n)},show:function(){o({visible:!0,onHide:function(){o({visible:!1})}})},hide:function(){o({visible:!1})},update:function(e){o(e)}}},Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,ReactDOM,primereact.utils,primereact.button,primereact.csstransition,primereact.api,primereact.overlayservice,primereact.portal);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.confirmpopup=function(e,t,n,i,r,o,s,c,l){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(t),p=a(n),f=a(s);function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(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 v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},y(e,t)}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}function b(e){return b="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},b(e)}function k(e,t){if(t&&("object"===b(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(){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}}function C(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 O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){L(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var R=function(e){m(L,e);var t,n,a,p,y,b=(t=L,n=j(),function(){var e,i=E(t);if(n){var r=E(this).constructor;e=Reflect.construct(i,arguments,r)}else e=i.apply(this,arguments);return k(this,e)});function L(e){var t;return d(this,L),(t=b.call(this,e)).state={visible:!1},t.reject=t.reject.bind(v(t)),t.accept=t.accept.bind(v(t)),t.hide=t.hide.bind(v(t)),t.onCloseClick=t.onCloseClick.bind(v(t)),t.onPanelClick=t.onPanelClick.bind(v(t)),t.onEnter=t.onEnter.bind(v(t)),t.onEntered=t.onEntered.bind(v(t)),t.onExit=t.onExit.bind(v(t)),t.onExited=t.onExited.bind(v(t)),t.overlayRef=u.default.createRef(),t.acceptBtnRef=u.default.createRef(),t}return a=L,(p=[{key:"acceptLabel",value:function(){return this.props.acceptLabel||s.localeOption("accept")}},{key:"rejectLabel",value:function(){return this.props.rejectLabel||s.localeOption("reject")}},{key:"bindDocumentClickListener",value:function(){var e=this;!this.documentClickListener&&this.props.dismissable&&(this.documentClickListener=function(t){!e.isPanelClicked&&e.isOutsideClicked(t.target)&&e.hide(),e.isPanelClicked=!1},document.addEventListener("click",this.documentClickListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new i.ConnectedOverlayScrollHandler(this.props.target,(function(){e.state.visible&&e.hide()}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"bindResizeListener",value:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.state.visible&&!i.DomHandler.isTouchDevice()&&e.hide()},window.addEventListener("resize",this.resizeListener))}},{key:"unbindResizeListener",value:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)}},{key:"isOutsideClicked",value:function(e){return this.overlayRef&&this.overlayRef.current&&!(this.overlayRef.current.isSameNode(e)||this.overlayRef.current.contains(e))}},{key:"onCloseClick",value:function(e){this.hide(),e.preventDefault()}},{key:"onPanelClick",value:function(e){this.isPanelClicked=!0,c.OverlayService.emit("overlay-click",{originalEvent:e,target:this.props.target})}},{key:"accept",value:function(){this.props.accept&&this.props.accept(),this.hide("accept")}},{key:"reject",value:function(){this.props.reject&&this.props.reject(),this.hide("reject")}},{key:"show",value:function(){var e=this;this.setState({visible:!0},(function(){e.overlayEventListener=function(t){e.isOutsideClicked(t.target)||(e.isPanelClicked=!0)},c.OverlayService.on("overlay-click",e.overlayEventListener)}))}},{key:"hide",value:function(e){var t=this;this.setState({visible:!1},(function(){c.OverlayService.off("overlay-click",t.overlayEventListener),t.overlayEventListener=null,t.props.onHide&&t.props.onHide(e)}))}},{key:"onEnter",value:function(){i.ZIndexUtils.set("overlay",this.overlayRef.current,f.default.autoZIndex,f.default.zIndex.overlay),this.align()}},{key:"onEntered",value:function(){this.bindDocumentClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.acceptBtnRef&&this.acceptBtnRef.current&&this.acceptBtnRef.current.focus(),this.props.onShow&&this.props.onShow()}},{key:"onExit",value:function(){this.unbindDocumentClickListener(),this.unbindScrollListener(),this.unbindResizeListener()}},{key:"onExited",value:function(){i.ZIndexUtils.clear(this.overlayRef.current)}},{key:"align",value:function(){if(this.props.target){i.DomHandler.absolutePosition(this.overlayRef.current,this.props.target);var e=i.DomHandler.getOffset(this.overlayRef.current),t=i.DomHandler.getOffset(this.props.target),n=0;e.left<t.left&&(n=t.left-e.left),this.overlayRef.current.style.setProperty("--overlayArrowLeft","".concat(n,"px")),e.top<t.top&&i.DomHandler.addClass(this.overlayRef.current,"p-confirm-popup-flipped")}}},{key:"componentDidMount",value:function(){this.props.visible&&this.setState({visible:!0})}},{key:"componentDidUpdate",value:function(e){e.visible!==this.props.visible&&this.setState({visible:this.props.visible})}},{key:"componentWillUnmount",value:function(){this.unbindDocumentClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.overlayEventListener&&(c.OverlayService.off("overlay-click",this.overlayEventListener),this.overlayEventListener=null),i.ZIndexUtils.clear(this.overlayRef.current)}},{key:"renderContent",value:function(){var e=i.ObjectUtils.getJSXElement(this.props.message,this.props);return u.default.createElement("div",{className:"p-confirm-popup-content"},i.IconUtils.getJSXIcon(this.props.icon,{className:"p-confirm-popup-icon"},{props:this.props}),u.default.createElement("span",{className:"p-confirm-popup-message"},e))}},{key:"renderFooter",value:function(){var e=i.classNames("p-confirm-popup-accept p-button-sm",this.props.acceptClassName),t=i.classNames("p-confirm-popup-reject p-button-sm",{"p-button-text":!this.props.rejectClassName},this.props.rejectClassName),n=u.default.createElement("div",{className:"p-confirm-popup-footer"},u.default.createElement(r.Button,{label:this.rejectLabel(),icon:this.props.rejectIcon,className:t,onClick:this.reject}),u.default.createElement(r.Button,{ref:this.acceptBtnRef,label:this.acceptLabel(),icon:this.props.acceptIcon,className:e,onClick:this.accept}));if(this.props.footer){var o={accept:this.accept,reject:this.reject,className:"p-confirm-popup-footer",acceptClassName:e,rejectClassName:t,acceptLabel:this.acceptLabel(),rejectLabel:this.rejectLabel(),element:n,props:this.props};return i.ObjectUtils.getJSXElement(this.props.footer,o)}return n}},{key:"renderElement",value:function(){var e=i.classNames("p-confirm-popup p-component",this.props.className),t=this.renderContent(),n=this.renderFooter();return u.default.createElement(o.CSSTransition,{nodeRef:this.overlayRef,classNames:"p-connected-overlay",in:this.state.visible,timeout:{enter:120,exit:100},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},u.default.createElement("div",{ref:this.overlayRef,id:this.props.id,className:e,style:this.props.style,onClick:this.onPanelClick},t,n))}},{key:"render",value:function(){var e=this.renderElement();return u.default.createElement(l.Portal,{element:e,appendTo:this.props.appendTo,visible:this.props.visible})}}])&&h(a.prototype,p),y&&h(a,y),L}(t.Component);return L(R,"defaultProps",{target:null,visible:!1,message:null,rejectLabel:null,acceptLabel:null,icon:null,rejectIcon:null,acceptIcon:null,rejectClassName:null,acceptClassName:null,className:null,style:null,appendTo:null,dismissable:!0,footer:null,onShow:null,onHide:null,accept:null,reject:null,transitionOptions:null}),e.ConfirmPopup=R,e.confirmPopup=function(e){var t=e.appendTo||document.body,n=document.createDocumentFragment();i.DomHandler.appendChild(n,t),e=O(O({},e),{visible:void 0===e.visible||e.visible});var r=u.default.createElement(R,e);p.default.render(r,n);var o=function(t){e=O(O({},e),t),p.default.render(u.default.cloneElement(r,e),n)};return{_destroy:function(){p.default.unmountComponentAtNode(n)},show:function(){o({visible:!0,onHide:function(){o({visible:!1})}})},hide:function(){o({visible:!1})},update:function(e){o(e)}}},Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,ReactDOM,primereact.utils,primereact.button,primereact.csstransition,primereact.api,primereact.overlayservice,primereact.portal);
|
|
@@ -566,7 +566,7 @@ var ContextMenu = /*#__PURE__*/function (_Component2) {
|
|
|
566
566
|
|
|
567
567
|
if (!this.documentResizeListener) {
|
|
568
568
|
this.documentResizeListener = function (event) {
|
|
569
|
-
if (_this9.state.visible && !utils.DomHandler.
|
|
569
|
+
if (_this9.state.visible && !utils.DomHandler.isTouchDevice()) {
|
|
570
570
|
_this9.hide(event);
|
|
571
571
|
}
|
|
572
572
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils"),n=require("primereact/csstransition"),i=require("primereact/ripple"),r=require("primereact/portal"),o=require("primereact/api");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=u(e),l=u(o);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 m(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),e}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function p(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&&f(e,t)}function h(e){return h="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},h(e)}function v(e,t){if(t&&("object"===h(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return d(e)}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e){var t=k();return function(){var n,i=b(e);if(t){var r=b(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return v(this,n)}}function k(){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(r){p(u,e.Component);var o=E(u);function u(e){var t;return a(this,u),(t=o.call(this,e)).state={activeItem:null},t.onEnter=t.onEnter.bind(d(t)),t.submenuRef=s.default.createRef(),t}return m(u,[{key:"onItemMouseEnter",value:function(e,t){t.disabled?e.preventDefault():this.setState({activeItem:t})}},{key:"onItemClick",value:function(e,t){t.disabled?e.preventDefault():(t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t}),t.items||this.props.onLeafClick(e))}},{key:"position",value:function(){var e=this.submenuRef.current.parentElement,n=t.DomHandler.getOffset(this.submenuRef.current.parentElement),i=t.DomHandler.getViewport(),r=this.submenuRef.current.offsetParent?this.submenuRef.current.offsetWidth:t.DomHandler.getHiddenElementOuterWidth(this.submenuRef.current),o=t.DomHandler.getOuterWidth(e.children[0]);this.submenuRef.current.style.top="0px",this.submenuRef.current.style.left=parseInt(n.left,10)+o+r>i.width-t.DomHandler.calculateScrollbarWidth()?-1*r+"px":o+"px"}},{key:"onEnter",value:function(){this.position()}},{key:"isActive",value:function(){return this.props.root||!this.props.resetMenu}},{key:"componentDidUpdate",value:function(){this.isActive()&&this.position()}},{key:"renderSeparator",value:function(e){return s.default.createElement("li",{key:"separator_"+e,className:"p-menu-separator",role:"separator"})}},{key:"renderSubmenu",value:function(e){return e.items?s.default.createElement(u,{model:e.items,resetMenu:e!==this.state.activeItem,onLeafClick:this.props.onLeafClick}):null}},{key:"renderMenuitem",value:function(e,n){var r=this,o=this.state.activeItem===e,u=t.classNames("p-menuitem",{"p-menuitem-active":o},e.className),l=t.classNames("p-menuitem-link",{"p-disabled":e.disabled}),a=t.classNames("p-menuitem-icon",e.icon),c="p-submenu-icon pi pi-angle-right",m=e.icon&&s.default.createElement("span",{className:a}),d=e.label&&s.default.createElement("span",{className:"p-menuitem-text"},e.label),f=e.items&&s.default.createElement("span",{className:c}),p=this.renderSubmenu(e),h=s.default.createElement("a",{href:e.url||"#",className:l,target:e.target,onClick:function(t){return r.onItemClick(t,e,n)},role:"menuitem","aria-haspopup":null!=e.items,"aria-disabled":e.disabled},m,d,f,s.default.createElement(i.Ripple,null));e.template&&(h=t.ObjectUtils.getJSXElement(e.template,e,{onClick:function(t){return r.onItemClick(t,e,n)},className:l,labelClassName:"p-menuitem-text",iconClassName:a,submenuIconClassName:c,element:h,props:this.props,active:o}));return s.default.createElement("li",{key:e.label+"_"+n,role:"none",className:u,style:e.style,onMouseEnter:function(t){return r.onItemMouseEnter(t,e)}},h,p)}},{key:"renderItem",value:function(e,t){return e.separator?this.renderSeparator(t):this.renderMenuitem(e,t)}},{key:"renderMenu",value:function(){var e=this;return this.props.model?this.props.model.map((function(t,n){return e.renderItem(t,n)})):null}},{key:"render",value:function(){var e=t.classNames({"p-submenu-list":!this.props.root}),i=this.renderMenu(),r=this.isActive();return s.default.createElement(n.CSSTransition,{nodeRef:this.submenuRef,classNames:"p-contextmenusub",in:r,timeout:{enter:0,exit:0},unmountOnExit:!0,onEnter:this.onEnter},s.default.createElement("ul",{ref:this.submenuRef,className:e},i))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!0===e.resetMenu?{activeItem:null}:null}}]),u}();y(L,"defaultProps",{model:null,root:!1,className:null,resetMenu:!1,onLeafClick:null});var x=function(i){p(u,e.Component);var o=E(u);function u(e){var t;return a(this,u),(t=o.call(this,e)).state={visible:!1,reshow:!1,resetMenu:!1},t.onMenuClick=t.onMenuClick.bind(d(t)),t.onLeafClick=t.onLeafClick.bind(d(t)),t.onMenuMouseEnter=t.onMenuMouseEnter.bind(d(t)),t.onEnter=t.onEnter.bind(d(t)),t.onEntered=t.onEntered.bind(d(t)),t.onExit=t.onExit.bind(d(t)),t.onExited=t.onExited.bind(d(t)),t.menuRef=s.default.createRef(),t}return m(u,[{key:"onMenuClick",value:function(){this.setState({resetMenu:!1})}},{key:"onMenuMouseEnter",value:function(){this.setState({resetMenu:!1})}},{key:"show",value:function(e){var t=this;e instanceof Event||e.persist(),e.stopPropagation(),e.preventDefault(),this.currentEvent=e,this.state.visible?this.setState({reshow:!0}):this.setState({visible:!0},(function(){t.props.onShow&&t.props.onShow(t.currentEvent)}))}},{key:"hide",value:function(e){var t=this;e instanceof Event||e.persist(),this.currentEvent=e,this.setState({visible:!1,reshow:!1},(function(){t.props.onHide&&t.props.onHide(t.currentEvent)}))}},{key:"onEnter",value:function(){this.props.autoZIndex&&t.ZIndexUtils.set("menu",this.menuRef.current,l.default.autoZIndex,this.props.baseZIndex||l.default.zIndex.menu),this.position(this.currentEvent)}},{key:"onEntered",value:function(){this.bindDocumentListeners()}},{key:"onExit",value:function(){this.currentEvent=null,this.unbindDocumentListeners()}},{key:"onExited",value:function(){t.ZIndexUtils.clear(this.menuRef.current)}},{key:"position",value:function(e){if(e){var n=e.pageX+1,i=e.pageY+1,r=this.menuRef.current.offsetParent?this.menuRef.current.offsetWidth:t.DomHandler.getHiddenElementOuterWidth(this.menuRef.current),o=this.menuRef.current.offsetParent?this.menuRef.current.offsetHeight:t.DomHandler.getHiddenElementOuterHeight(this.menuRef.current),u=t.DomHandler.getViewport();n+r-document.body.scrollLeft>u.width&&(n-=r),i+o-document.body.scrollTop>u.height&&(i-=o),n<document.body.scrollLeft&&(n=document.body.scrollLeft),i<document.body.scrollTop&&(i=document.body.scrollTop),this.menuRef.current.style.left=n+"px",this.menuRef.current.style.top=i+"px"}}},{key:"onLeafClick",value:function(e){this.setState({resetMenu:!0}),this.hide(e),e.stopPropagation()}},{key:"isOutsideClicked",value:function(e){return this.menuRef&&this.menuRef.current&&!(this.menuRef.current.isSameNode(e.target)||this.menuRef.current.contains(e.target))}},{key:"bindDocumentListeners",value:function(){this.bindDocumentResizeListener(),this.bindDocumentClickListener()}},{key:"unbindDocumentListeners",value:function(){this.unbindDocumentResizeListener(),this.unbindDocumentClickListener()}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){e.isOutsideClicked(t)&&2!==t.button&&(e.hide(t),e.setState({resetMenu:!0}))},document.addEventListener("click",this.documentClickListener))}},{key:"bindDocumentContextMenuListener",value:function(){var e=this;this.documentContextMenuListener||(this.documentContextMenuListener=function(t){e.show(t)},document.addEventListener("contextmenu",this.documentContextMenuListener))}},{key:"bindDocumentResizeListener",value:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(n){e.state.visible&&!t.DomHandler.isAndroid()&&e.hide(n)},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"unbindDocumentContextMenuListener",value:function(){this.documentContextMenuListener&&(document.removeEventListener("contextmenu",this.documentContextMenuListener),this.documentContextMenuListener=null)}},{key:"unbindDocumentResizeListener",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"componentDidMount",value:function(){this.props.global&&this.bindDocumentContextMenuListener()}},{key:"componentDidUpdate",value:function(e,t){var n=this;if(this.state.visible&&(t.reshow!==this.state.reshow||e.model!==this.props.model)){var i=this.currentEvent;this.setState({visible:!1,reshow:!1,rePosition:!1,resetMenu:!0},(function(){return n.show(i)}))}}},{key:"componentWillUnmount",value:function(){this.unbindDocumentListeners(),this.unbindDocumentContextMenuListener(),t.ZIndexUtils.clear(this.menuRef.current)}},{key:"renderContextMenu",value:function(){var e=t.classNames("p-contextmenu p-component",this.props.className);return s.default.createElement(n.CSSTransition,{nodeRef:this.menuRef,classNames:"p-contextmenu",in:this.state.visible,timeout:{enter:250,exit:0},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},s.default.createElement("div",{ref:this.menuRef,id:this.props.id,className:e,style:this.props.style,onClick:this.onMenuClick,onMouseEnter:this.onMenuMouseEnter},s.default.createElement(L,{model:this.props.model,root:!0,resetMenu:this.state.resetMenu,onLeafClick:this.onLeafClick})))}},{key:"render",value:function(){var e=this.renderContextMenu();return s.default.createElement(r.Portal,{element:e,appendTo:this.props.appendTo})}}]),u}();y(x,"defaultProps",{id:null,model:null,style:null,className:null,global:!1,autoZIndex:!0,baseZIndex:0,appendTo:null,transitionOptions:null,onShow:null,onHide:null}),exports.ContextMenu=x;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils"),n=require("primereact/csstransition"),i=require("primereact/ripple"),r=require("primereact/portal"),o=require("primereact/api");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=u(e),l=u(o);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 m(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),e}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function p(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&&d(e,t)}function h(e){return h="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},h(e)}function v(e,t){if(t&&("object"===h(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e){var t=k();return function(){var n,i=b(e);if(t){var r=b(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return v(this,n)}}function k(){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(r){p(u,e.Component);var o=E(u);function u(e){var t;return a(this,u),(t=o.call(this,e)).state={activeItem:null},t.onEnter=t.onEnter.bind(f(t)),t.submenuRef=s.default.createRef(),t}return m(u,[{key:"onItemMouseEnter",value:function(e,t){t.disabled?e.preventDefault():this.setState({activeItem:t})}},{key:"onItemClick",value:function(e,t){t.disabled?e.preventDefault():(t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t}),t.items||this.props.onLeafClick(e))}},{key:"position",value:function(){var e=this.submenuRef.current.parentElement,n=t.DomHandler.getOffset(this.submenuRef.current.parentElement),i=t.DomHandler.getViewport(),r=this.submenuRef.current.offsetParent?this.submenuRef.current.offsetWidth:t.DomHandler.getHiddenElementOuterWidth(this.submenuRef.current),o=t.DomHandler.getOuterWidth(e.children[0]);this.submenuRef.current.style.top="0px",this.submenuRef.current.style.left=parseInt(n.left,10)+o+r>i.width-t.DomHandler.calculateScrollbarWidth()?-1*r+"px":o+"px"}},{key:"onEnter",value:function(){this.position()}},{key:"isActive",value:function(){return this.props.root||!this.props.resetMenu}},{key:"componentDidUpdate",value:function(){this.isActive()&&this.position()}},{key:"renderSeparator",value:function(e){return s.default.createElement("li",{key:"separator_"+e,className:"p-menu-separator",role:"separator"})}},{key:"renderSubmenu",value:function(e){return e.items?s.default.createElement(u,{model:e.items,resetMenu:e!==this.state.activeItem,onLeafClick:this.props.onLeafClick}):null}},{key:"renderMenuitem",value:function(e,n){var r=this,o=this.state.activeItem===e,u=t.classNames("p-menuitem",{"p-menuitem-active":o},e.className),l=t.classNames("p-menuitem-link",{"p-disabled":e.disabled}),a=t.classNames("p-menuitem-icon",e.icon),c="p-submenu-icon pi pi-angle-right",m=e.icon&&s.default.createElement("span",{className:a}),f=e.label&&s.default.createElement("span",{className:"p-menuitem-text"},e.label),d=e.items&&s.default.createElement("span",{className:c}),p=this.renderSubmenu(e),h=s.default.createElement("a",{href:e.url||"#",className:l,target:e.target,onClick:function(t){return r.onItemClick(t,e,n)},role:"menuitem","aria-haspopup":null!=e.items,"aria-disabled":e.disabled},m,f,d,s.default.createElement(i.Ripple,null));e.template&&(h=t.ObjectUtils.getJSXElement(e.template,e,{onClick:function(t){return r.onItemClick(t,e,n)},className:l,labelClassName:"p-menuitem-text",iconClassName:a,submenuIconClassName:c,element:h,props:this.props,active:o}));return s.default.createElement("li",{key:e.label+"_"+n,role:"none",className:u,style:e.style,onMouseEnter:function(t){return r.onItemMouseEnter(t,e)}},h,p)}},{key:"renderItem",value:function(e,t){return e.separator?this.renderSeparator(t):this.renderMenuitem(e,t)}},{key:"renderMenu",value:function(){var e=this;return this.props.model?this.props.model.map((function(t,n){return e.renderItem(t,n)})):null}},{key:"render",value:function(){var e=t.classNames({"p-submenu-list":!this.props.root}),i=this.renderMenu(),r=this.isActive();return s.default.createElement(n.CSSTransition,{nodeRef:this.submenuRef,classNames:"p-contextmenusub",in:r,timeout:{enter:0,exit:0},unmountOnExit:!0,onEnter:this.onEnter},s.default.createElement("ul",{ref:this.submenuRef,className:e},i))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!0===e.resetMenu?{activeItem:null}:null}}]),u}();y(L,"defaultProps",{model:null,root:!1,className:null,resetMenu:!1,onLeafClick:null});var x=function(i){p(u,e.Component);var o=E(u);function u(e){var t;return a(this,u),(t=o.call(this,e)).state={visible:!1,reshow:!1,resetMenu:!1},t.onMenuClick=t.onMenuClick.bind(f(t)),t.onLeafClick=t.onLeafClick.bind(f(t)),t.onMenuMouseEnter=t.onMenuMouseEnter.bind(f(t)),t.onEnter=t.onEnter.bind(f(t)),t.onEntered=t.onEntered.bind(f(t)),t.onExit=t.onExit.bind(f(t)),t.onExited=t.onExited.bind(f(t)),t.menuRef=s.default.createRef(),t}return m(u,[{key:"onMenuClick",value:function(){this.setState({resetMenu:!1})}},{key:"onMenuMouseEnter",value:function(){this.setState({resetMenu:!1})}},{key:"show",value:function(e){var t=this;e instanceof Event||e.persist(),e.stopPropagation(),e.preventDefault(),this.currentEvent=e,this.state.visible?this.setState({reshow:!0}):this.setState({visible:!0},(function(){t.props.onShow&&t.props.onShow(t.currentEvent)}))}},{key:"hide",value:function(e){var t=this;e instanceof Event||e.persist(),this.currentEvent=e,this.setState({visible:!1,reshow:!1},(function(){t.props.onHide&&t.props.onHide(t.currentEvent)}))}},{key:"onEnter",value:function(){this.props.autoZIndex&&t.ZIndexUtils.set("menu",this.menuRef.current,l.default.autoZIndex,this.props.baseZIndex||l.default.zIndex.menu),this.position(this.currentEvent)}},{key:"onEntered",value:function(){this.bindDocumentListeners()}},{key:"onExit",value:function(){this.currentEvent=null,this.unbindDocumentListeners()}},{key:"onExited",value:function(){t.ZIndexUtils.clear(this.menuRef.current)}},{key:"position",value:function(e){if(e){var n=e.pageX+1,i=e.pageY+1,r=this.menuRef.current.offsetParent?this.menuRef.current.offsetWidth:t.DomHandler.getHiddenElementOuterWidth(this.menuRef.current),o=this.menuRef.current.offsetParent?this.menuRef.current.offsetHeight:t.DomHandler.getHiddenElementOuterHeight(this.menuRef.current),u=t.DomHandler.getViewport();n+r-document.body.scrollLeft>u.width&&(n-=r),i+o-document.body.scrollTop>u.height&&(i-=o),n<document.body.scrollLeft&&(n=document.body.scrollLeft),i<document.body.scrollTop&&(i=document.body.scrollTop),this.menuRef.current.style.left=n+"px",this.menuRef.current.style.top=i+"px"}}},{key:"onLeafClick",value:function(e){this.setState({resetMenu:!0}),this.hide(e),e.stopPropagation()}},{key:"isOutsideClicked",value:function(e){return this.menuRef&&this.menuRef.current&&!(this.menuRef.current.isSameNode(e.target)||this.menuRef.current.contains(e.target))}},{key:"bindDocumentListeners",value:function(){this.bindDocumentResizeListener(),this.bindDocumentClickListener()}},{key:"unbindDocumentListeners",value:function(){this.unbindDocumentResizeListener(),this.unbindDocumentClickListener()}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){e.isOutsideClicked(t)&&2!==t.button&&(e.hide(t),e.setState({resetMenu:!0}))},document.addEventListener("click",this.documentClickListener))}},{key:"bindDocumentContextMenuListener",value:function(){var e=this;this.documentContextMenuListener||(this.documentContextMenuListener=function(t){e.show(t)},document.addEventListener("contextmenu",this.documentContextMenuListener))}},{key:"bindDocumentResizeListener",value:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(n){e.state.visible&&!t.DomHandler.isTouchDevice()&&e.hide(n)},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"unbindDocumentContextMenuListener",value:function(){this.documentContextMenuListener&&(document.removeEventListener("contextmenu",this.documentContextMenuListener),this.documentContextMenuListener=null)}},{key:"unbindDocumentResizeListener",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"componentDidMount",value:function(){this.props.global&&this.bindDocumentContextMenuListener()}},{key:"componentDidUpdate",value:function(e,t){var n=this;if(this.state.visible&&(t.reshow!==this.state.reshow||e.model!==this.props.model)){var i=this.currentEvent;this.setState({visible:!1,reshow:!1,rePosition:!1,resetMenu:!0},(function(){return n.show(i)}))}}},{key:"componentWillUnmount",value:function(){this.unbindDocumentListeners(),this.unbindDocumentContextMenuListener(),t.ZIndexUtils.clear(this.menuRef.current)}},{key:"renderContextMenu",value:function(){var e=t.classNames("p-contextmenu p-component",this.props.className);return s.default.createElement(n.CSSTransition,{nodeRef:this.menuRef,classNames:"p-contextmenu",in:this.state.visible,timeout:{enter:250,exit:0},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},s.default.createElement("div",{ref:this.menuRef,id:this.props.id,className:e,style:this.props.style,onClick:this.onMenuClick,onMouseEnter:this.onMenuMouseEnter},s.default.createElement(L,{model:this.props.model,root:!0,resetMenu:this.state.resetMenu,onLeafClick:this.onLeafClick})))}},{key:"render",value:function(){var e=this.renderContextMenu();return s.default.createElement(r.Portal,{element:e,appendTo:this.props.appendTo})}}]),u}();y(x,"defaultProps",{id:null,model:null,style:null,className:null,global:!1,autoZIndex:!0,baseZIndex:0,appendTo:null,transitionOptions:null,onShow:null,onHide:null}),exports.ContextMenu=x;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MenuItem } from '../menuitem';
|
|
3
|
+
import { CSSTransitionProps } from '../csstransition';
|
|
3
4
|
|
|
4
5
|
type ContextMenuAppendToType = 'self' | HTMLElement | undefined | null;
|
|
5
6
|
|
|
@@ -12,7 +13,7 @@ export interface ContextMenuProps {
|
|
|
12
13
|
autoZIndex?: boolean;
|
|
13
14
|
baseZIndex?: number;
|
|
14
15
|
appendTo?: ContextMenuAppendToType;
|
|
15
|
-
transitionOptions?:
|
|
16
|
+
transitionOptions?: CSSTransitionProps;
|
|
16
17
|
onShow?(e: React.SyntheticEvent): void;
|
|
17
18
|
onHide?(e: React.SyntheticEvent): void;
|
|
18
19
|
}
|
|
@@ -557,7 +557,7 @@ var ContextMenu = /*#__PURE__*/function (_Component2) {
|
|
|
557
557
|
|
|
558
558
|
if (!this.documentResizeListener) {
|
|
559
559
|
this.documentResizeListener = function (event) {
|
|
560
|
-
if (_this9.state.visible && !DomHandler.
|
|
560
|
+
if (_this9.state.visible && !DomHandler.isTouchDevice()) {
|
|
561
561
|
_this9.hide(event);
|
|
562
562
|
}
|
|
563
563
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{Component as t}from"react";import{DomHandler as n,classNames as i,ObjectUtils as r,ZIndexUtils as o}from"primereact/utils";import{CSSTransition as s}from"primereact/csstransition";import{Ripple as u}from"primereact/ripple";import{Portal as c}from"primereact/portal";import l from"primereact/api";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(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 f(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),e}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function h(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&&d(e,t)}function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function b(e,t){if(t&&("object"===v(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return p(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k(e){var t=L();return function(){var n,i=y(e);if(t){var r=y(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return b(this,n)}}function L(){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 R=function(o){h(l,t);var c=k(l);function l(t){var n;return a(this,l),(n=c.call(this,t)).state={activeItem:null},n.onEnter=n.onEnter.bind(p(n)),n.submenuRef=e.createRef(),n}return f(l,[{key:"onItemMouseEnter",value:function(e,t){t.disabled?e.preventDefault():this.setState({activeItem:t})}},{key:"onItemClick",value:function(e,t){t.disabled?e.preventDefault():(t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t}),t.items||this.props.onLeafClick(e))}},{key:"position",value:function(){var e=this.submenuRef.current.parentElement,t=n.getOffset(this.submenuRef.current.parentElement),i=n.getViewport(),r=this.submenuRef.current.offsetParent?this.submenuRef.current.offsetWidth:n.getHiddenElementOuterWidth(this.submenuRef.current),o=n.getOuterWidth(e.children[0]);this.submenuRef.current.style.top="0px",this.submenuRef.current.style.left=parseInt(t.left,10)+o+r>i.width-n.calculateScrollbarWidth()?-1*r+"px":o+"px"}},{key:"onEnter",value:function(){this.position()}},{key:"isActive",value:function(){return this.props.root||!this.props.resetMenu}},{key:"componentDidUpdate",value:function(){this.isActive()&&this.position()}},{key:"renderSeparator",value:function(t){return e.createElement("li",{key:"separator_"+t,className:"p-menu-separator",role:"separator"})}},{key:"renderSubmenu",value:function(t){return t.items?e.createElement(l,{model:t.items,resetMenu:t!==this.state.activeItem,onLeafClick:this.props.onLeafClick}):null}},{key:"renderMenuitem",value:function(t,n){var o=this,s=this.state.activeItem===t,c=i("p-menuitem",{"p-menuitem-active":s},t.className),l=i("p-menuitem-link",{"p-disabled":t.disabled}),a=i("p-menuitem-icon",t.icon),m="p-submenu-icon pi pi-angle-right",f=t.icon&&e.createElement("span",{className:a}),p=t.label&&e.createElement("span",{className:"p-menuitem-text"},t.label),d=t.items&&e.createElement("span",{className:m}),h=this.renderSubmenu(t),v=e.createElement("a",{href:t.url||"#",className:l,target:t.target,onClick:function(e){return o.onItemClick(e,t,n)},role:"menuitem","aria-haspopup":null!=t.items,"aria-disabled":t.disabled},f,p,d,e.createElement(u,null));t.template&&(v=r.getJSXElement(t.template,t,{onClick:function(e){return o.onItemClick(e,t,n)},className:l,labelClassName:"p-menuitem-text",iconClassName:a,submenuIconClassName:m,element:v,props:this.props,active:s}));return e.createElement("li",{key:t.label+"_"+n,role:"none",className:c,style:t.style,onMouseEnter:function(e){return o.onItemMouseEnter(e,t)}},v,h)}},{key:"renderItem",value:function(e,t){return e.separator?this.renderSeparator(t):this.renderMenuitem(e,t)}},{key:"renderMenu",value:function(){var e=this;return this.props.model?this.props.model.map((function(t,n){return e.renderItem(t,n)})):null}},{key:"render",value:function(){var t=i({"p-submenu-list":!this.props.root}),n=this.renderMenu(),r=this.isActive();return e.createElement(s,{nodeRef:this.submenuRef,classNames:"p-contextmenusub",in:r,timeout:{enter:0,exit:0},unmountOnExit:!0,onEnter:this.onEnter},e.createElement("ul",{ref:this.submenuRef,className:t},n))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!0===e.resetMenu?{activeItem:null}:null}}]),l}();E(R,"defaultProps",{model:null,root:!1,className:null,resetMenu:!1,onLeafClick:null});var x=function(r){h(m,t);var u=k(m);function m(t){var n;return a(this,m),(n=u.call(this,t)).state={visible:!1,reshow:!1,resetMenu:!1},n.onMenuClick=n.onMenuClick.bind(p(n)),n.onLeafClick=n.onLeafClick.bind(p(n)),n.onMenuMouseEnter=n.onMenuMouseEnter.bind(p(n)),n.onEnter=n.onEnter.bind(p(n)),n.onEntered=n.onEntered.bind(p(n)),n.onExit=n.onExit.bind(p(n)),n.onExited=n.onExited.bind(p(n)),n.menuRef=e.createRef(),n}return f(m,[{key:"onMenuClick",value:function(){this.setState({resetMenu:!1})}},{key:"onMenuMouseEnter",value:function(){this.setState({resetMenu:!1})}},{key:"show",value:function(e){var t=this;e instanceof Event||e.persist(),e.stopPropagation(),e.preventDefault(),this.currentEvent=e,this.state.visible?this.setState({reshow:!0}):this.setState({visible:!0},(function(){t.props.onShow&&t.props.onShow(t.currentEvent)}))}},{key:"hide",value:function(e){var t=this;e instanceof Event||e.persist(),this.currentEvent=e,this.setState({visible:!1,reshow:!1},(function(){t.props.onHide&&t.props.onHide(t.currentEvent)}))}},{key:"onEnter",value:function(){this.props.autoZIndex&&o.set("menu",this.menuRef.current,l.autoZIndex,this.props.baseZIndex||l.zIndex.menu),this.position(this.currentEvent)}},{key:"onEntered",value:function(){this.bindDocumentListeners()}},{key:"onExit",value:function(){this.currentEvent=null,this.unbindDocumentListeners()}},{key:"onExited",value:function(){o.clear(this.menuRef.current)}},{key:"position",value:function(e){if(e){var t=e.pageX+1,i=e.pageY+1,r=this.menuRef.current.offsetParent?this.menuRef.current.offsetWidth:n.getHiddenElementOuterWidth(this.menuRef.current),o=this.menuRef.current.offsetParent?this.menuRef.current.offsetHeight:n.getHiddenElementOuterHeight(this.menuRef.current),s=n.getViewport();t+r-document.body.scrollLeft>s.width&&(t-=r),i+o-document.body.scrollTop>s.height&&(i-=o),t<document.body.scrollLeft&&(t=document.body.scrollLeft),i<document.body.scrollTop&&(i=document.body.scrollTop),this.menuRef.current.style.left=t+"px",this.menuRef.current.style.top=i+"px"}}},{key:"onLeafClick",value:function(e){this.setState({resetMenu:!0}),this.hide(e),e.stopPropagation()}},{key:"isOutsideClicked",value:function(e){return this.menuRef&&this.menuRef.current&&!(this.menuRef.current.isSameNode(e.target)||this.menuRef.current.contains(e.target))}},{key:"bindDocumentListeners",value:function(){this.bindDocumentResizeListener(),this.bindDocumentClickListener()}},{key:"unbindDocumentListeners",value:function(){this.unbindDocumentResizeListener(),this.unbindDocumentClickListener()}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){e.isOutsideClicked(t)&&2!==t.button&&(e.hide(t),e.setState({resetMenu:!0}))},document.addEventListener("click",this.documentClickListener))}},{key:"bindDocumentContextMenuListener",value:function(){var e=this;this.documentContextMenuListener||(this.documentContextMenuListener=function(t){e.show(t)},document.addEventListener("contextmenu",this.documentContextMenuListener))}},{key:"bindDocumentResizeListener",value:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(t){e.state.visible&&!n.isAndroid()&&e.hide(t)},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"unbindDocumentContextMenuListener",value:function(){this.documentContextMenuListener&&(document.removeEventListener("contextmenu",this.documentContextMenuListener),this.documentContextMenuListener=null)}},{key:"unbindDocumentResizeListener",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"componentDidMount",value:function(){this.props.global&&this.bindDocumentContextMenuListener()}},{key:"componentDidUpdate",value:function(e,t){var n=this;if(this.state.visible&&(t.reshow!==this.state.reshow||e.model!==this.props.model)){var i=this.currentEvent;this.setState({visible:!1,reshow:!1,rePosition:!1,resetMenu:!0},(function(){return n.show(i)}))}}},{key:"componentWillUnmount",value:function(){this.unbindDocumentListeners(),this.unbindDocumentContextMenuListener(),o.clear(this.menuRef.current)}},{key:"renderContextMenu",value:function(){var t=i("p-contextmenu p-component",this.props.className);return e.createElement(s,{nodeRef:this.menuRef,classNames:"p-contextmenu",in:this.state.visible,timeout:{enter:250,exit:0},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},e.createElement("div",{ref:this.menuRef,id:this.props.id,className:t,style:this.props.style,onClick:this.onMenuClick,onMouseEnter:this.onMenuMouseEnter},e.createElement(R,{model:this.props.model,root:!0,resetMenu:this.state.resetMenu,onLeafClick:this.onLeafClick})))}},{key:"render",value:function(){var t=this.renderContextMenu();return e.createElement(c,{element:t,appendTo:this.props.appendTo})}}]),m}();E(x,"defaultProps",{id:null,model:null,style:null,className:null,global:!1,autoZIndex:!0,baseZIndex:0,appendTo:null,transitionOptions:null,onShow:null,onHide:null});export{x as ContextMenu};
|
|
1
|
+
import e,{Component as t}from"react";import{DomHandler as n,classNames as i,ObjectUtils as r,ZIndexUtils as o}from"primereact/utils";import{CSSTransition as s}from"primereact/csstransition";import{Ripple as u}from"primereact/ripple";import{Portal as c}from"primereact/portal";import l from"primereact/api";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(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 f(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),e}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function h(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&&d(e,t)}function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function b(e,t){if(t&&("object"===v(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return p(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k(e){var t=L();return function(){var n,i=y(e);if(t){var r=y(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return b(this,n)}}function L(){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 R=function(o){h(l,t);var c=k(l);function l(t){var n;return a(this,l),(n=c.call(this,t)).state={activeItem:null},n.onEnter=n.onEnter.bind(p(n)),n.submenuRef=e.createRef(),n}return f(l,[{key:"onItemMouseEnter",value:function(e,t){t.disabled?e.preventDefault():this.setState({activeItem:t})}},{key:"onItemClick",value:function(e,t){t.disabled?e.preventDefault():(t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t}),t.items||this.props.onLeafClick(e))}},{key:"position",value:function(){var e=this.submenuRef.current.parentElement,t=n.getOffset(this.submenuRef.current.parentElement),i=n.getViewport(),r=this.submenuRef.current.offsetParent?this.submenuRef.current.offsetWidth:n.getHiddenElementOuterWidth(this.submenuRef.current),o=n.getOuterWidth(e.children[0]);this.submenuRef.current.style.top="0px",this.submenuRef.current.style.left=parseInt(t.left,10)+o+r>i.width-n.calculateScrollbarWidth()?-1*r+"px":o+"px"}},{key:"onEnter",value:function(){this.position()}},{key:"isActive",value:function(){return this.props.root||!this.props.resetMenu}},{key:"componentDidUpdate",value:function(){this.isActive()&&this.position()}},{key:"renderSeparator",value:function(t){return e.createElement("li",{key:"separator_"+t,className:"p-menu-separator",role:"separator"})}},{key:"renderSubmenu",value:function(t){return t.items?e.createElement(l,{model:t.items,resetMenu:t!==this.state.activeItem,onLeafClick:this.props.onLeafClick}):null}},{key:"renderMenuitem",value:function(t,n){var o=this,s=this.state.activeItem===t,c=i("p-menuitem",{"p-menuitem-active":s},t.className),l=i("p-menuitem-link",{"p-disabled":t.disabled}),a=i("p-menuitem-icon",t.icon),m="p-submenu-icon pi pi-angle-right",f=t.icon&&e.createElement("span",{className:a}),p=t.label&&e.createElement("span",{className:"p-menuitem-text"},t.label),d=t.items&&e.createElement("span",{className:m}),h=this.renderSubmenu(t),v=e.createElement("a",{href:t.url||"#",className:l,target:t.target,onClick:function(e){return o.onItemClick(e,t,n)},role:"menuitem","aria-haspopup":null!=t.items,"aria-disabled":t.disabled},f,p,d,e.createElement(u,null));t.template&&(v=r.getJSXElement(t.template,t,{onClick:function(e){return o.onItemClick(e,t,n)},className:l,labelClassName:"p-menuitem-text",iconClassName:a,submenuIconClassName:m,element:v,props:this.props,active:s}));return e.createElement("li",{key:t.label+"_"+n,role:"none",className:c,style:t.style,onMouseEnter:function(e){return o.onItemMouseEnter(e,t)}},v,h)}},{key:"renderItem",value:function(e,t){return e.separator?this.renderSeparator(t):this.renderMenuitem(e,t)}},{key:"renderMenu",value:function(){var e=this;return this.props.model?this.props.model.map((function(t,n){return e.renderItem(t,n)})):null}},{key:"render",value:function(){var t=i({"p-submenu-list":!this.props.root}),n=this.renderMenu(),r=this.isActive();return e.createElement(s,{nodeRef:this.submenuRef,classNames:"p-contextmenusub",in:r,timeout:{enter:0,exit:0},unmountOnExit:!0,onEnter:this.onEnter},e.createElement("ul",{ref:this.submenuRef,className:t},n))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!0===e.resetMenu?{activeItem:null}:null}}]),l}();E(R,"defaultProps",{model:null,root:!1,className:null,resetMenu:!1,onLeafClick:null});var x=function(r){h(m,t);var u=k(m);function m(t){var n;return a(this,m),(n=u.call(this,t)).state={visible:!1,reshow:!1,resetMenu:!1},n.onMenuClick=n.onMenuClick.bind(p(n)),n.onLeafClick=n.onLeafClick.bind(p(n)),n.onMenuMouseEnter=n.onMenuMouseEnter.bind(p(n)),n.onEnter=n.onEnter.bind(p(n)),n.onEntered=n.onEntered.bind(p(n)),n.onExit=n.onExit.bind(p(n)),n.onExited=n.onExited.bind(p(n)),n.menuRef=e.createRef(),n}return f(m,[{key:"onMenuClick",value:function(){this.setState({resetMenu:!1})}},{key:"onMenuMouseEnter",value:function(){this.setState({resetMenu:!1})}},{key:"show",value:function(e){var t=this;e instanceof Event||e.persist(),e.stopPropagation(),e.preventDefault(),this.currentEvent=e,this.state.visible?this.setState({reshow:!0}):this.setState({visible:!0},(function(){t.props.onShow&&t.props.onShow(t.currentEvent)}))}},{key:"hide",value:function(e){var t=this;e instanceof Event||e.persist(),this.currentEvent=e,this.setState({visible:!1,reshow:!1},(function(){t.props.onHide&&t.props.onHide(t.currentEvent)}))}},{key:"onEnter",value:function(){this.props.autoZIndex&&o.set("menu",this.menuRef.current,l.autoZIndex,this.props.baseZIndex||l.zIndex.menu),this.position(this.currentEvent)}},{key:"onEntered",value:function(){this.bindDocumentListeners()}},{key:"onExit",value:function(){this.currentEvent=null,this.unbindDocumentListeners()}},{key:"onExited",value:function(){o.clear(this.menuRef.current)}},{key:"position",value:function(e){if(e){var t=e.pageX+1,i=e.pageY+1,r=this.menuRef.current.offsetParent?this.menuRef.current.offsetWidth:n.getHiddenElementOuterWidth(this.menuRef.current),o=this.menuRef.current.offsetParent?this.menuRef.current.offsetHeight:n.getHiddenElementOuterHeight(this.menuRef.current),s=n.getViewport();t+r-document.body.scrollLeft>s.width&&(t-=r),i+o-document.body.scrollTop>s.height&&(i-=o),t<document.body.scrollLeft&&(t=document.body.scrollLeft),i<document.body.scrollTop&&(i=document.body.scrollTop),this.menuRef.current.style.left=t+"px",this.menuRef.current.style.top=i+"px"}}},{key:"onLeafClick",value:function(e){this.setState({resetMenu:!0}),this.hide(e),e.stopPropagation()}},{key:"isOutsideClicked",value:function(e){return this.menuRef&&this.menuRef.current&&!(this.menuRef.current.isSameNode(e.target)||this.menuRef.current.contains(e.target))}},{key:"bindDocumentListeners",value:function(){this.bindDocumentResizeListener(),this.bindDocumentClickListener()}},{key:"unbindDocumentListeners",value:function(){this.unbindDocumentResizeListener(),this.unbindDocumentClickListener()}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){e.isOutsideClicked(t)&&2!==t.button&&(e.hide(t),e.setState({resetMenu:!0}))},document.addEventListener("click",this.documentClickListener))}},{key:"bindDocumentContextMenuListener",value:function(){var e=this;this.documentContextMenuListener||(this.documentContextMenuListener=function(t){e.show(t)},document.addEventListener("contextmenu",this.documentContextMenuListener))}},{key:"bindDocumentResizeListener",value:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(t){e.state.visible&&!n.isTouchDevice()&&e.hide(t)},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"unbindDocumentContextMenuListener",value:function(){this.documentContextMenuListener&&(document.removeEventListener("contextmenu",this.documentContextMenuListener),this.documentContextMenuListener=null)}},{key:"unbindDocumentResizeListener",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"componentDidMount",value:function(){this.props.global&&this.bindDocumentContextMenuListener()}},{key:"componentDidUpdate",value:function(e,t){var n=this;if(this.state.visible&&(t.reshow!==this.state.reshow||e.model!==this.props.model)){var i=this.currentEvent;this.setState({visible:!1,reshow:!1,rePosition:!1,resetMenu:!0},(function(){return n.show(i)}))}}},{key:"componentWillUnmount",value:function(){this.unbindDocumentListeners(),this.unbindDocumentContextMenuListener(),o.clear(this.menuRef.current)}},{key:"renderContextMenu",value:function(){var t=i("p-contextmenu p-component",this.props.className);return e.createElement(s,{nodeRef:this.menuRef,classNames:"p-contextmenu",in:this.state.visible,timeout:{enter:250,exit:0},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},e.createElement("div",{ref:this.menuRef,id:this.props.id,className:t,style:this.props.style,onClick:this.onMenuClick,onMouseEnter:this.onMenuMouseEnter},e.createElement(R,{model:this.props.model,root:!0,resetMenu:this.state.resetMenu,onLeafClick:this.onLeafClick})))}},{key:"render",value:function(){var t=this.renderContextMenu();return e.createElement(c,{element:t,appendTo:this.props.appendTo})}}]),m}();E(x,"defaultProps",{id:null,model:null,style:null,className:null,global:!1,autoZIndex:!0,baseZIndex:0,appendTo:null,transitionOptions:null,onShow:null,onHide:null});export{x as ContextMenu};
|
|
@@ -559,7 +559,7 @@ this.primereact.contextmenu = (function (exports, React, utils, csstransition, r
|
|
|
559
559
|
|
|
560
560
|
if (!this.documentResizeListener) {
|
|
561
561
|
this.documentResizeListener = function (event) {
|
|
562
|
-
if (_this9.state.visible && !utils.DomHandler.
|
|
562
|
+
if (_this9.state.visible && !utils.DomHandler.isTouchDevice()) {
|
|
563
563
|
_this9.hide(event);
|
|
564
564
|
}
|
|
565
565
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.contextmenu=function(e,t,n,i,r,o,s){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(t),a=u(s);function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(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 f(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),e}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function h(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&&p(e,t)}function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function b(e,t){if(t&&("object"===v(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return d(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k(e){var t=L();return function(){var n,i=y(e);if(t){var r=y(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return b(this,n)}}function L(){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 C=function(e){h(o,e);var t=k(o);function o(e){var n;return c(this,o),(n=t.call(this,e)).state={activeItem:null},n.onEnter=n.onEnter.bind(d(n)),n.submenuRef=l.default.createRef(),n}return f(o,[{key:"onItemMouseEnter",value:function(e,t){t.disabled?e.preventDefault():this.setState({activeItem:t})}},{key:"onItemClick",value:function(e,t){t.disabled?e.preventDefault():(t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t}),t.items||this.props.onLeafClick(e))}},{key:"position",value:function(){var e=this.submenuRef.current.parentElement,t=n.DomHandler.getOffset(this.submenuRef.current.parentElement),i=n.DomHandler.getViewport(),r=this.submenuRef.current.offsetParent?this.submenuRef.current.offsetWidth:n.DomHandler.getHiddenElementOuterWidth(this.submenuRef.current),o=n.DomHandler.getOuterWidth(e.children[0]);this.submenuRef.current.style.top="0px",this.submenuRef.current.style.left=parseInt(t.left,10)+o+r>i.width-n.DomHandler.calculateScrollbarWidth()?-1*r+"px":o+"px"}},{key:"onEnter",value:function(){this.position()}},{key:"isActive",value:function(){return this.props.root||!this.props.resetMenu}},{key:"componentDidUpdate",value:function(){this.isActive()&&this.position()}},{key:"renderSeparator",value:function(e){return l.default.createElement("li",{key:"separator_"+e,className:"p-menu-separator",role:"separator"})}},{key:"renderSubmenu",value:function(e){return e.items?l.default.createElement(o,{model:e.items,resetMenu:e!==this.state.activeItem,onLeafClick:this.props.onLeafClick}):null}},{key:"renderMenuitem",value:function(e,t){var i=this,o=this.state.activeItem===e,s=n.classNames("p-menuitem",{"p-menuitem-active":o},e.className),u=n.classNames("p-menuitem-link",{"p-disabled":e.disabled}),a=n.classNames("p-menuitem-icon",e.icon),c="p-submenu-icon pi pi-angle-right",m=e.icon&&l.default.createElement("span",{className:a}),f=e.label&&l.default.createElement("span",{className:"p-menuitem-text"},e.label),d=e.items&&l.default.createElement("span",{className:c}),p=this.renderSubmenu(e),h=l.default.createElement("a",{href:e.url||"#",className:u,target:e.target,onClick:function(n){return i.onItemClick(n,e,t)},role:"menuitem","aria-haspopup":null!=e.items,"aria-disabled":e.disabled},m,f,d,l.default.createElement(r.Ripple,null));e.template&&(h=n.ObjectUtils.getJSXElement(e.template,e,{onClick:function(n){return i.onItemClick(n,e,t)},className:u,labelClassName:"p-menuitem-text",iconClassName:a,submenuIconClassName:c,element:h,props:this.props,active:o}));return l.default.createElement("li",{key:e.label+"_"+t,role:"none",className:s,style:e.style,onMouseEnter:function(t){return i.onItemMouseEnter(t,e)}},h,p)}},{key:"renderItem",value:function(e,t){return e.separator?this.renderSeparator(t):this.renderMenuitem(e,t)}},{key:"renderMenu",value:function(){var e=this;return this.props.model?this.props.model.map((function(t,n){return e.renderItem(t,n)})):null}},{key:"render",value:function(){var e=n.classNames({"p-submenu-list":!this.props.root}),t=this.renderMenu(),r=this.isActive();return l.default.createElement(i.CSSTransition,{nodeRef:this.submenuRef,classNames:"p-contextmenusub",in:r,timeout:{enter:0,exit:0},unmountOnExit:!0,onEnter:this.onEnter},l.default.createElement("ul",{ref:this.submenuRef,className:e},t))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!0===e.resetMenu?{activeItem:null}:null}}]),o}(t.Component);E(C,"defaultProps",{model:null,root:!1,className:null,resetMenu:!1,onLeafClick:null});var x=function(e){h(r,e);var t=k(r);function r(e){var n;return c(this,r),(n=t.call(this,e)).state={visible:!1,reshow:!1,resetMenu:!1},n.onMenuClick=n.onMenuClick.bind(d(n)),n.onLeafClick=n.onLeafClick.bind(d(n)),n.onMenuMouseEnter=n.onMenuMouseEnter.bind(d(n)),n.onEnter=n.onEnter.bind(d(n)),n.onEntered=n.onEntered.bind(d(n)),n.onExit=n.onExit.bind(d(n)),n.onExited=n.onExited.bind(d(n)),n.menuRef=l.default.createRef(),n}return f(r,[{key:"onMenuClick",value:function(){this.setState({resetMenu:!1})}},{key:"onMenuMouseEnter",value:function(){this.setState({resetMenu:!1})}},{key:"show",value:function(e){var t=this;e instanceof Event||e.persist(),e.stopPropagation(),e.preventDefault(),this.currentEvent=e,this.state.visible?this.setState({reshow:!0}):this.setState({visible:!0},(function(){t.props.onShow&&t.props.onShow(t.currentEvent)}))}},{key:"hide",value:function(e){var t=this;e instanceof Event||e.persist(),this.currentEvent=e,this.setState({visible:!1,reshow:!1},(function(){t.props.onHide&&t.props.onHide(t.currentEvent)}))}},{key:"onEnter",value:function(){this.props.autoZIndex&&n.ZIndexUtils.set("menu",this.menuRef.current,a.default.autoZIndex,this.props.baseZIndex||a.default.zIndex.menu),this.position(this.currentEvent)}},{key:"onEntered",value:function(){this.bindDocumentListeners()}},{key:"onExit",value:function(){this.currentEvent=null,this.unbindDocumentListeners()}},{key:"onExited",value:function(){n.ZIndexUtils.clear(this.menuRef.current)}},{key:"position",value:function(e){if(e){var t=e.pageX+1,i=e.pageY+1,r=this.menuRef.current.offsetParent?this.menuRef.current.offsetWidth:n.DomHandler.getHiddenElementOuterWidth(this.menuRef.current),o=this.menuRef.current.offsetParent?this.menuRef.current.offsetHeight:n.DomHandler.getHiddenElementOuterHeight(this.menuRef.current),s=n.DomHandler.getViewport();t+r-document.body.scrollLeft>s.width&&(t-=r),i+o-document.body.scrollTop>s.height&&(i-=o),t<document.body.scrollLeft&&(t=document.body.scrollLeft),i<document.body.scrollTop&&(i=document.body.scrollTop),this.menuRef.current.style.left=t+"px",this.menuRef.current.style.top=i+"px"}}},{key:"onLeafClick",value:function(e){this.setState({resetMenu:!0}),this.hide(e),e.stopPropagation()}},{key:"isOutsideClicked",value:function(e){return this.menuRef&&this.menuRef.current&&!(this.menuRef.current.isSameNode(e.target)||this.menuRef.current.contains(e.target))}},{key:"bindDocumentListeners",value:function(){this.bindDocumentResizeListener(),this.bindDocumentClickListener()}},{key:"unbindDocumentListeners",value:function(){this.unbindDocumentResizeListener(),this.unbindDocumentClickListener()}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){e.isOutsideClicked(t)&&2!==t.button&&(e.hide(t),e.setState({resetMenu:!0}))},document.addEventListener("click",this.documentClickListener))}},{key:"bindDocumentContextMenuListener",value:function(){var e=this;this.documentContextMenuListener||(this.documentContextMenuListener=function(t){e.show(t)},document.addEventListener("contextmenu",this.documentContextMenuListener))}},{key:"bindDocumentResizeListener",value:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(t){e.state.visible&&!n.DomHandler.isAndroid()&&e.hide(t)},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"unbindDocumentContextMenuListener",value:function(){this.documentContextMenuListener&&(document.removeEventListener("contextmenu",this.documentContextMenuListener),this.documentContextMenuListener=null)}},{key:"unbindDocumentResizeListener",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"componentDidMount",value:function(){this.props.global&&this.bindDocumentContextMenuListener()}},{key:"componentDidUpdate",value:function(e,t){var n=this;if(this.state.visible&&(t.reshow!==this.state.reshow||e.model!==this.props.model)){var i=this.currentEvent;this.setState({visible:!1,reshow:!1,rePosition:!1,resetMenu:!0},(function(){return n.show(i)}))}}},{key:"componentWillUnmount",value:function(){this.unbindDocumentListeners(),this.unbindDocumentContextMenuListener(),n.ZIndexUtils.clear(this.menuRef.current)}},{key:"renderContextMenu",value:function(){var e=n.classNames("p-contextmenu p-component",this.props.className);return l.default.createElement(i.CSSTransition,{nodeRef:this.menuRef,classNames:"p-contextmenu",in:this.state.visible,timeout:{enter:250,exit:0},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},l.default.createElement("div",{ref:this.menuRef,id:this.props.id,className:e,style:this.props.style,onClick:this.onMenuClick,onMouseEnter:this.onMenuMouseEnter},l.default.createElement(C,{model:this.props.model,root:!0,resetMenu:this.state.resetMenu,onLeafClick:this.onLeafClick})))}},{key:"render",value:function(){var e=this.renderContextMenu();return l.default.createElement(o.Portal,{element:e,appendTo:this.props.appendTo})}}]),r}(t.Component);return E(x,"defaultProps",{id:null,model:null,style:null,className:null,global:!1,autoZIndex:!0,baseZIndex:0,appendTo:null,transitionOptions:null,onShow:null,onHide:null}),e.ContextMenu=x,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils,primereact.csstransition,primereact.ripple,primereact.portal,primereact.api);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.contextmenu=function(e,t,n,i,r,o,s){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(t),a=u(s);function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(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 f(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),e}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function h(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&&p(e,t)}function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function b(e,t){if(t&&("object"===v(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return d(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k(e){var t=L();return function(){var n,i=y(e);if(t){var r=y(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return b(this,n)}}function L(){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 C=function(e){h(o,e);var t=k(o);function o(e){var n;return c(this,o),(n=t.call(this,e)).state={activeItem:null},n.onEnter=n.onEnter.bind(d(n)),n.submenuRef=l.default.createRef(),n}return f(o,[{key:"onItemMouseEnter",value:function(e,t){t.disabled?e.preventDefault():this.setState({activeItem:t})}},{key:"onItemClick",value:function(e,t){t.disabled?e.preventDefault():(t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t}),t.items||this.props.onLeafClick(e))}},{key:"position",value:function(){var e=this.submenuRef.current.parentElement,t=n.DomHandler.getOffset(this.submenuRef.current.parentElement),i=n.DomHandler.getViewport(),r=this.submenuRef.current.offsetParent?this.submenuRef.current.offsetWidth:n.DomHandler.getHiddenElementOuterWidth(this.submenuRef.current),o=n.DomHandler.getOuterWidth(e.children[0]);this.submenuRef.current.style.top="0px",this.submenuRef.current.style.left=parseInt(t.left,10)+o+r>i.width-n.DomHandler.calculateScrollbarWidth()?-1*r+"px":o+"px"}},{key:"onEnter",value:function(){this.position()}},{key:"isActive",value:function(){return this.props.root||!this.props.resetMenu}},{key:"componentDidUpdate",value:function(){this.isActive()&&this.position()}},{key:"renderSeparator",value:function(e){return l.default.createElement("li",{key:"separator_"+e,className:"p-menu-separator",role:"separator"})}},{key:"renderSubmenu",value:function(e){return e.items?l.default.createElement(o,{model:e.items,resetMenu:e!==this.state.activeItem,onLeafClick:this.props.onLeafClick}):null}},{key:"renderMenuitem",value:function(e,t){var i=this,o=this.state.activeItem===e,s=n.classNames("p-menuitem",{"p-menuitem-active":o},e.className),u=n.classNames("p-menuitem-link",{"p-disabled":e.disabled}),a=n.classNames("p-menuitem-icon",e.icon),c="p-submenu-icon pi pi-angle-right",m=e.icon&&l.default.createElement("span",{className:a}),f=e.label&&l.default.createElement("span",{className:"p-menuitem-text"},e.label),d=e.items&&l.default.createElement("span",{className:c}),p=this.renderSubmenu(e),h=l.default.createElement("a",{href:e.url||"#",className:u,target:e.target,onClick:function(n){return i.onItemClick(n,e,t)},role:"menuitem","aria-haspopup":null!=e.items,"aria-disabled":e.disabled},m,f,d,l.default.createElement(r.Ripple,null));e.template&&(h=n.ObjectUtils.getJSXElement(e.template,e,{onClick:function(n){return i.onItemClick(n,e,t)},className:u,labelClassName:"p-menuitem-text",iconClassName:a,submenuIconClassName:c,element:h,props:this.props,active:o}));return l.default.createElement("li",{key:e.label+"_"+t,role:"none",className:s,style:e.style,onMouseEnter:function(t){return i.onItemMouseEnter(t,e)}},h,p)}},{key:"renderItem",value:function(e,t){return e.separator?this.renderSeparator(t):this.renderMenuitem(e,t)}},{key:"renderMenu",value:function(){var e=this;return this.props.model?this.props.model.map((function(t,n){return e.renderItem(t,n)})):null}},{key:"render",value:function(){var e=n.classNames({"p-submenu-list":!this.props.root}),t=this.renderMenu(),r=this.isActive();return l.default.createElement(i.CSSTransition,{nodeRef:this.submenuRef,classNames:"p-contextmenusub",in:r,timeout:{enter:0,exit:0},unmountOnExit:!0,onEnter:this.onEnter},l.default.createElement("ul",{ref:this.submenuRef,className:e},t))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!0===e.resetMenu?{activeItem:null}:null}}]),o}(t.Component);E(C,"defaultProps",{model:null,root:!1,className:null,resetMenu:!1,onLeafClick:null});var x=function(e){h(r,e);var t=k(r);function r(e){var n;return c(this,r),(n=t.call(this,e)).state={visible:!1,reshow:!1,resetMenu:!1},n.onMenuClick=n.onMenuClick.bind(d(n)),n.onLeafClick=n.onLeafClick.bind(d(n)),n.onMenuMouseEnter=n.onMenuMouseEnter.bind(d(n)),n.onEnter=n.onEnter.bind(d(n)),n.onEntered=n.onEntered.bind(d(n)),n.onExit=n.onExit.bind(d(n)),n.onExited=n.onExited.bind(d(n)),n.menuRef=l.default.createRef(),n}return f(r,[{key:"onMenuClick",value:function(){this.setState({resetMenu:!1})}},{key:"onMenuMouseEnter",value:function(){this.setState({resetMenu:!1})}},{key:"show",value:function(e){var t=this;e instanceof Event||e.persist(),e.stopPropagation(),e.preventDefault(),this.currentEvent=e,this.state.visible?this.setState({reshow:!0}):this.setState({visible:!0},(function(){t.props.onShow&&t.props.onShow(t.currentEvent)}))}},{key:"hide",value:function(e){var t=this;e instanceof Event||e.persist(),this.currentEvent=e,this.setState({visible:!1,reshow:!1},(function(){t.props.onHide&&t.props.onHide(t.currentEvent)}))}},{key:"onEnter",value:function(){this.props.autoZIndex&&n.ZIndexUtils.set("menu",this.menuRef.current,a.default.autoZIndex,this.props.baseZIndex||a.default.zIndex.menu),this.position(this.currentEvent)}},{key:"onEntered",value:function(){this.bindDocumentListeners()}},{key:"onExit",value:function(){this.currentEvent=null,this.unbindDocumentListeners()}},{key:"onExited",value:function(){n.ZIndexUtils.clear(this.menuRef.current)}},{key:"position",value:function(e){if(e){var t=e.pageX+1,i=e.pageY+1,r=this.menuRef.current.offsetParent?this.menuRef.current.offsetWidth:n.DomHandler.getHiddenElementOuterWidth(this.menuRef.current),o=this.menuRef.current.offsetParent?this.menuRef.current.offsetHeight:n.DomHandler.getHiddenElementOuterHeight(this.menuRef.current),s=n.DomHandler.getViewport();t+r-document.body.scrollLeft>s.width&&(t-=r),i+o-document.body.scrollTop>s.height&&(i-=o),t<document.body.scrollLeft&&(t=document.body.scrollLeft),i<document.body.scrollTop&&(i=document.body.scrollTop),this.menuRef.current.style.left=t+"px",this.menuRef.current.style.top=i+"px"}}},{key:"onLeafClick",value:function(e){this.setState({resetMenu:!0}),this.hide(e),e.stopPropagation()}},{key:"isOutsideClicked",value:function(e){return this.menuRef&&this.menuRef.current&&!(this.menuRef.current.isSameNode(e.target)||this.menuRef.current.contains(e.target))}},{key:"bindDocumentListeners",value:function(){this.bindDocumentResizeListener(),this.bindDocumentClickListener()}},{key:"unbindDocumentListeners",value:function(){this.unbindDocumentResizeListener(),this.unbindDocumentClickListener()}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){e.isOutsideClicked(t)&&2!==t.button&&(e.hide(t),e.setState({resetMenu:!0}))},document.addEventListener("click",this.documentClickListener))}},{key:"bindDocumentContextMenuListener",value:function(){var e=this;this.documentContextMenuListener||(this.documentContextMenuListener=function(t){e.show(t)},document.addEventListener("contextmenu",this.documentContextMenuListener))}},{key:"bindDocumentResizeListener",value:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(t){e.state.visible&&!n.DomHandler.isTouchDevice()&&e.hide(t)},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"unbindDocumentContextMenuListener",value:function(){this.documentContextMenuListener&&(document.removeEventListener("contextmenu",this.documentContextMenuListener),this.documentContextMenuListener=null)}},{key:"unbindDocumentResizeListener",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"componentDidMount",value:function(){this.props.global&&this.bindDocumentContextMenuListener()}},{key:"componentDidUpdate",value:function(e,t){var n=this;if(this.state.visible&&(t.reshow!==this.state.reshow||e.model!==this.props.model)){var i=this.currentEvent;this.setState({visible:!1,reshow:!1,rePosition:!1,resetMenu:!0},(function(){return n.show(i)}))}}},{key:"componentWillUnmount",value:function(){this.unbindDocumentListeners(),this.unbindDocumentContextMenuListener(),n.ZIndexUtils.clear(this.menuRef.current)}},{key:"renderContextMenu",value:function(){var e=n.classNames("p-contextmenu p-component",this.props.className);return l.default.createElement(i.CSSTransition,{nodeRef:this.menuRef,classNames:"p-contextmenu",in:this.state.visible,timeout:{enter:250,exit:0},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},l.default.createElement("div",{ref:this.menuRef,id:this.props.id,className:e,style:this.props.style,onClick:this.onMenuClick,onMouseEnter:this.onMenuMouseEnter},l.default.createElement(C,{model:this.props.model,root:!0,resetMenu:this.state.resetMenu,onLeafClick:this.onLeafClick})))}},{key:"render",value:function(){var e=this.renderContextMenu();return l.default.createElement(o.Portal,{element:e,appendTo:this.props.appendTo})}}]),r}(t.Component);return E(x,"defaultProps",{id:null,model:null,style:null,className:null,global:!1,autoZIndex:!0,baseZIndex:0,appendTo:null,transitionOptions:null,onShow:null,onHide:null}),e.ContextMenu=x,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils,primereact.csstransition,primereact.ripple,primereact.portal,primereact.api);
|