2 lines
7.2 KiB
JavaScript
2 lines
7.2 KiB
JavaScript
|
this.primereact=this.primereact||{},this.primereact.sidebar=function(e,t,n,s,i,o,r){"use strict";function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=l(t),c=l(r);function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}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 m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(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 h(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 d(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function v(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var k,E,S,C=function(e){m(E,e);var t,r,l,f,b,k=(t=E,r=v(),function(){var e,n=y(t);if(r){var s=y(this).constructor;e=Reflect.construct(n,arguments,s)}else e=n.apply(this,arguments);return h(this,e)});function E(e){var t;return u(this,E),(t=k.call(this,e)).state={maskVisible:!1,visible:!1},t.onMaskClick=t.onMaskClick.bind(d(t)),t.onClose=t.onClose.bind(d(t)),t.onEntered=t.onEntered.bind(d(t)),t.onExiting=t.onExiting.bind(d(t)),t.onExited=t.onExited.bind(d(t)),t.sidebarRef=a.default.createRef(),t}return l=E,(f=[{key:"getPositionClass",value:function(){var e=this,t=["left","right","top","bottom"].find((function(t){return t===e.props.position}));return t?"p-sidebar-".concat(t):""}},{key:"focus",value:function(){var e=document.activeElement;!(e&&this.sidebarRef&&this.sidebarRef.current.contains(e))&&this.props.showCloseIcon&&this.closeIcon.focus()}},{key:"onMaskClick",value:function(e){this.props.dismissable&&this.props.modal&&this.mask===e.target&&this.onClose(e)}},{key:"onClose",value:function(e){this.props.onHide(),e.preventDefault()}},{key:"onEntered",value:function(){this.props.onShow&&this.props.onShow(),this.focus(),this.enableDocumentSettings()}},{key:"onExiting",value:function(){this.props.modal&&n.DomHandler.addClass(this.mask,"p-component-overlay-leave")}},{key:"onExited",value:function(){n.ZIndexUtils.clear(this.mask),this.setState({maskVisible:!1}),this.disableDocumentSettings()}},{key:"enableDocumentSettings",value:function(){this.bindGlobalListeners(),this.props.blockScroll&&n.DomHandler.addClass(document.body,"p-overflow-hidden")}},{key:"disableDocumentSettings",value:function(){this.unbindGlobalListeners(),this.props.blockScroll&&n.DomHandler.removeClass(document.body,"p-overflow-hidden")}},{key:"bindGlobalListeners",value:function(){this.props.closeOnEscape&&this.bindDocumentEscapeListener()}},{key:"unbindGlobalListeners",value:function(){this.unbindDocumentEscapeListener()}},{key:"bindDocumentEscapeListener",value:function(){var e=this;this.documentEscapeListener=function(t){27===t.which&&n.ZIndexUtils.get(e.mask)===n.ZIndexUtils.getCurrent("modal",c.default.autoZIndex)&&e.onClose(t)},document.addEventListener("keydown",this.documentEscapeListener)}},{key:"unbindDocumentEscapeListener",value:function(){this.documentEscapeListener&&(document.removeEventListener("keydown",this.documentEscapeListener),this.doc
|