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

2 lines
8.9 KiB
JavaScript

this.primereact=this.primereact||{},this.primereact.toast=function(e,t,n,r,o,s,i,a){"use strict";function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=l(t),u=l(i);function p(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 f(e){if(Array.isArray(e))return p(e)}function m(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function d(e,t){if(e){if("string"==typeof e)return p(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)?p(e,t):void 0}}function y(){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 h(e){return f(e)||m(e)||d(e)||y()}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(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 g(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e,t){return C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},C(e,t)}function E(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&&C(e,t)}function k(e){return k="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},k(e)}function w(e,t){if(t&&("object"===k(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}function j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},j(e)}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(){return S=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},S.apply(this,arguments)}function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function N(){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 T=function(e){E(i,e);var t,o,s=(t=i,o=N(),function(){var e,n=j(t);if(o){var r=j(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return w(this,e)});function i(e){var t;return v(this,i),(t=s.call(this,e)).onClick=t.onClick.bind(O(t)),t.onClose=t.onClose.bind(O(t)),t}return g(i,[{key:"componentWillUnmount",value:function(){this.timeout&&clearTimeout(this.timeout)}},{key:"componentDidMount",value:function(){var e=this;this.props.message.sticky||(this.timeout=setTimeout((function(){e.onClose(null)}),this.props.message.life||3e3))}},{key:"onClose",value:function(){this.timeout&&clearTimeout(this.timeout),this.props.onClose&&this.props.onClose(this.props.message)}},{key:"onClick",value:function(e){!this.props.onClick||n.DomHandler.hasClass(e.target,"p-toast-icon-close")||n.DomHandler.hasClass(e.target,"p-toast-icon-close-icon")||this.props.onClick(this.props.message)}},{key:"renderCloseIcon",value:function(){return!1!==this.props.message.closable?c.default.createElement("button",{type:"button",className:"p-toast-icon-close p-link",onClick:this.onClose},c.default.createElement("span",{className:"p-toast-icon-close-icon pi pi-times"}),c.default.createElement(r.Ripple,null)):null}},{key:"renderMessage",value:function(){if(this.props.message){var e=this.props.message,t=e.severity,r=e.summary,o=e.detail,s=n.ObjectUtils.getJSXElement(e.content,x(x({},this.props),{},{onClose:this.onClose})),i=n.classNames("p-toast-message-icon pi",{"pi-info-circle":"info"===t,"pi-exclamation-triangle":"warn"===t,"pi-times":"error"===t,"pi-check":"success"===t});return s||c.default.createElement(c.default.Fragment,null,c.default.createElement("span",{className:i}),c.default.createElement("div",{className:"p-toast-message-text"},c.default.createElement("span",{className:"p-toast-summary"},r),o&&c.default.createElement("div",{className:"p-toast-detail"},o)))}return null}},{key:"render",value:function(){var e=this.props.message.severity,t=this.props.message.contentClassName,r=this.props.message.contentStyle,o=this.props.message.style,s=n.classNames("p-toast-message",{"p-toast-message-info":"info"===e,"p-toast-message-warn":"warn"===e,"p-toast-message-error":"error"===e,"p-toast-message-success":"success"===e},this.props.message.className),i=this.renderMessage(),a=this.renderCloseIcon();return c.default.createElement("div",{ref:this.props.forwardRef,className:s,style:o,role:"alert","aria-live":"assertive","aria-atomic":"true",onClick:this.onClick},c.default.createElement("div",{className:n.classNames("p-toast-message-content",t),style:r},i,a))}}]),i}(t.Component);P(T,"defaultProps",{message:null,onClose:null,onClick:null});var I=c.default.forwardRef((function(e,t){return c.default.createElement(T,S({forwardRef:t},e))}));function _(){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 A=0,D=function(e){E(l,e);var t,r,i=(t=l,r=_(),function(){var e,n=j(t);if(r){var o=j(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return w(this,e)});function l(e){var t;return v(this,l),(t=i.call(this,e)).state={messages:[]},t.onClose=t.onClose.bind(O(t)),t.onEntered=t.onEntered.bind(O(t)),t.onExited=t.onExited.bind(O(t)),t}return g(l,[{key:"show",value:function(e){if(e&&e){var t;if(Array.isArray(e))for(var r=0;r<e.length;r++)e[r].id=A++,t=[].concat(h(this.state.messages),h(e));else e.id=A++,t=this.state.messages?[].concat(h(this.state.messages),[e]):[e];0===this.state.messages.length&&n.ZIndexUtils.set("toast",this.container,u.default.autoZIndex,this.props.baseZIndex||u.default.zIndex.toast),this.setState({messages:t})}}},{key:"clear",value:function(){n.ZIndexUtils.clear(this.container),this.setState({messages:[]})}},{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:"onEntered",value:function(){this.props.onShow&&this.props.onShow()}},{key:"onExited",value:function(){0===this.state.messages.length&&n.ZIndexUtils.clear(this.container),this.props.onHide&&this.props.onHide()}},{key:"componentWillUnmount",value:function(){n.ZIndexUtils.clear(this.container)}},{key:"renderElement",value:function(){var e=this,t=n.classNames("p-toast p-component p-toast-"+this.props.position,this.props.className);return c.default.createElement("div",{ref:function(t){e.container=t},id:this.props.id,className:t,style:this.props.style},c.default.createElement(o.TransitionGroup,null,this.state.messages.map((function(t){var n=c.default.createRef();return c.default.createElement(s.CSSTransition,{nodeRef:n,key:t.id,classNames:"p-toast-message",unmountOnExit:!0,timeout:{enter:300,exit:300},onEntered:e.onEntered,onExited:e.onExited,options:e.props.transitionOptions},c.default.createElement(I,{ref:n,message:t,onClick:e.props.onClick,onClose:e.onClose}))}))))}},{key:"render",value:function(){var e=this.renderElement();return c.default.createElement(a.Portal,{element:e,appendTo:this.props.appendTo})}}]),l}(t.Component);return P(D,"defaultProps",{id:null,className:null,style:null,baseZIndex:0,position:"top-right",transitionOptions:null,appendTo:"self",onClick:null,onRemove:null,onShow:null,onHide:null}),e.Toast=D,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils,primereact.ripple,ReactTransitionGroup,primereact.csstransition,primereact.api,primereact.portal);