2 lines
4.5 KiB
JavaScript
2 lines
4.5 KiB
JavaScript
this.primereact=this.primereact||{},this.primereact.inplace=function(e,t,n,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=o(t);function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function y(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return l(e)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function d(e){var t=b();return function(){var n,r=h(e);if(t){var o=h(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return y(this,n)}}function b(){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 v,m,g,w=function(e){p(n,e);var t=d(n);function n(){return a(this,n),t.apply(this,arguments)}return c(n,[{key:"render",value:function(){return this.props.children}}]),n}(t.Component),O=function(e){p(n,e);var t=d(n);function n(){return a(this,n),t.apply(this,arguments)}return c(n,[{key:"render",value:function(){return this.props.children}}]),n}(t.Component),C=function(e){p(o,e);var t=d(o);function o(e){var n;return a(this,o),(n=t.call(this,e)).props.onToggle||(n.state={active:!1}),n.open=n.open.bind(l(n)),n.close=n.close.bind(l(n)),n.onDisplayKeyDown=n.onDisplayKeyDown.bind(l(n)),n}return c(o,[{key:"open",value:function(e){this.props.disabled||(this.props.onOpen&&this.props.onOpen(e),this.props.onToggle?this.props.onToggle({originalEvent:e,value:!0}):this.setState({active:!0}))}},{key:"close",value:function(e){this.props.onClose&&this.props.onClose(e),this.props.onToggle?this.props.onToggle({originalEvent:e,value:!1}):this.setState({active:!1})}},{key:"onDisplayKeyDown",value:function(e){"Enter"===e.key&&(this.open(e),e.preventDefault())}},{key:"isActive",value:function(){return this.props.onToggle?this.props.active:this.state.active}},{key:"renderDisplay",value:function(e){var t=n.classNames("p-inplace-display",{"p-disabled":this.props.disabled});return i.default.createElement("div",{className:t,onClick:this.open,onKeyDown:this.onDisplayKeyDown,tabIndex:this.props.tabIndex,"aria-label":this.props.ariaLabel},e)}},{key:"renderCloseButton",value:function(){return this.props.closable?i.default.createElement(r.Button,{type:"button",className:"p-inplace-content-close",icon:"pi pi-times",onClick:this.close}):null}},{key:"renderContent",value:function(e){var t=this.renderCloseButton();return i.default.createElement("div",{className:"p-inplace-content"},e,t)}},{key:"renderChildren",value:function(){var e=this,t=this.isActive();return i.default.Children.map(this.props.children,(function(n,r){return t&&n.type===O?e.renderContent(n):t||n.type!==w?void 0:e.renderDisplay(n)}))}},{key:"render",value:function(){var e=n.classNames("p-inplace p-component",{"p-inplace-closable":this.props.closable},this.props.className);return i.default.createElement("div",{className:e},this.renderChildren())}}]),o}(t.Component);return g={style:null,className:null,active:!1,closable:!1,disabled:!1,tabIndex:0,ariaLabel:null,onOpen:null,onClose:null,onToggle:null},(m="defaultProps")in(v=C)?Object.defineProperty(v,m,{value:g,enumerable:!0,configurable:!0,writable:!0}):v[m]=g,e.Inplace=C,e.InplaceContent=O,e.InplaceDisplay=w,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils,primereact.button);
|