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

2 lines
6.9 KiB
JavaScript

this.primereact=this.primereact||{},this.primereact.messages=function(e,t,n,r,o,s){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(t);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e){if(Array.isArray(e))return l(e)}function c(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function f(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}function p(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e){return u(e)||c(e)||f(e)||p()}function y(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 r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e,t){return b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},b(e,t)}function g(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&&b(e,t)}function C(e){return C="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},C(e)}function k(e,t){if(t&&("object"===C(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 w(e){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},w(e)}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R(){return R=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},R.apply(this,arguments)}function E(){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 j=function(e){g(i,e);var t,o,s=(t=i,o=E(),function(){var e,n=w(t);if(o){var r=w(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return k(this,e)});function i(e){var t;return y(this,i),(t=s.call(this,e)).onClick=t.onClick.bind(v(t)),t.onClose=t.onClose.bind(v(t)),t}return d(i,[{key:"componentDidMount",value:function(){var e=this;this.props.message.sticky||(this.timeout=setTimeout((function(){e.onClose(null)}),this.props.message.life||3e3))}},{key:"componentWillUnmount",value:function(){this.timeout&&clearTimeout(this.timeout)}},{key:"onClose",value:function(e){this.timeout&&clearTimeout(this.timeout),this.props.onClose&&this.props.onClose(this.props.message),e&&(e.preventDefault(),e.stopPropagation())}},{key:"onClick",value:function(){this.props.onClick&&this.props.onClick(this.props.message)}},{key:"renderCloseIcon",value:function(){return!1!==this.props.message.closable?a.default.createElement("button",{type:"button",className:"p-message-close p-link",onClick:this.onClose},a.default.createElement("i",{className:"p-message-close-icon pi pi-times"}),a.default.createElement(r.Ripple,null)):null}},{key:"renderMessage",value:function(){if(this.props.message){var e=this.props.message,t=e.severity,r=e.content,o=e.summary,s=e.detail,i=n.classNames("p-message-icon pi ",{"pi-info-circle":"info"===t,"pi-check":"success"===t,"pi-exclamation-triangle":"warn"===t,"pi-times-circle":"error"===t});return r||a.default.createElement(a.default.Fragment,null,a.default.createElement("span",{className:i}),a.default.createElement("span",{className:"p-message-summary"},o),a.default.createElement("span",{className:"p-message-detail"},s))}return null}},{key:"render",value:function(){var e="p-message p-component p-message-"+this.props.message.severity,t=this.renderCloseIcon(),n=this.renderMessage();return a.default.createElement("div",{ref:this.props.forwardRef,className:e,onClick:this.onClick},a.default.createElement("div",{className:"p-message-wrapper"},n,t))}}]),i}(t.Component);O(j,"defaultProps",{message:null,onClose:null,onClick:null});var S=a.default.forwardRef((function(e,t){return a.default.createElement(j,R({forwardRef:t},e))}));function P(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var N=0,T=function(e){g(i,e);var t,n,r=(t=i,n=P(),function(){var e,r=w(t);if(n){var o=w(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return k(this,e)});function i(e){var t;return y(this,i),(t=r.call(this,e)).state={messages:[]},t.onClose=t.onClose.bind(v(t)),t}return d(i,[{key:"show",value:function(e){if(e){var t=[];if(Array.isArray(e))for(var n=0;n<e.length;n++)e[n].id=N++,t=[].concat(m(this.state.messages),m(e));else e.id=N++,t=this.state.messages?[].concat(m(this.state.messages),[e]):[e];this.setState({messages:t})}}},{key:"clear",value:function(){this.setState({messages:[]})}},{key:"replace",value:function(e){var t=this;this.setState({messages:[]},(function(){return t.show(e)}))}},{key:"onClose",value:function(e){var t=this.state.messages.filter((function(t){return t.id!==e.id}));this.setState({messages:t}),this.props.onRemove&&this.props.onRemove(e)}},{key:"render",value:function(){var e=this;return a.default.createElement("div",{id:this.props.id,className:this.props.className,style:this.props.style},a.default.createElement(o.TransitionGroup,null,this.state.messages.map((function(t){var n=a.default.createRef();return a.default.createElement(s.CSSTransition,{nodeRef:n,key:t.id,classNames:"p-message",unmountOnExit:!0,timeout:{enter:300,exit:300},options:e.props.transitionOptions},a.default.createElement(S,{ref:n,message:t,onClick:e.props.onClick,onClose:e.onClose}))}))))}}]),i}(t.Component);return O(T,"defaultProps",{id:null,className:null,style:null,transitionOptions:null,onRemove:null,onClick:null}),e.Messages=T,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils,primereact.ripple,ReactTransitionGroup,primereact.csstransition);