katoikia-app/web-ui/web-react/node_modules/primereact/inplace/inplace.cjs.min.js

2 lines
4.5 KiB
JavaScript

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