2 lines
3.2 KiB
JavaScript
2 lines
3.2 KiB
JavaScript
|
import e,{Component as t}from"react";import{ObjectUtils as r,classNames as n}from"primereact/utils";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(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&&s(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 l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(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 l(e)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function f(){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 y,m,h,b=function(s){c(v,t);var p,l,y,m,h,b=(p=v,l=f(),function(){var e,t=a(p);if(l){var r=a(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return u(this,e)});function v(){return o(this,v),b.apply(this,arguments)}return y=v,(m=[{key:"getContent",value:function(){if(this.props.content)return r.getJSXElement(this.props.content,this.props);var t=r.getJSXElement(this.props.text,this.props),o=n("p-inline-message-icon pi",{"pi-info-circle":"info"===this.props.severity,"pi-exclamation-triangle":"warn"===this.props.severity,"pi-times-circle":"error"===this.props.severity,"pi-check":"success"===this.props.severity});return e.createElement(e.Fragment,null,e.createElement("span",{className:o}),e.createElement("span",{className:"p-inline-message-text"},t))}},{key:"render",value:function(){var t=n("p-inline-message p-component",{"p-inline-message-info":"info"===this.props.severity,"p-inline-message-warn":"warn"===this.props.severity,"p-inline-message-error":"error"===this.props.severity,"p-inline-message-success":"success"===this.props.severity,"p-inline-message-icon-only":!this.props.text},this.props.className),r=this.getContent();return e.createElement("div",{id:this.props.id,"aria-live":"polite",className:t,style:this.props.style,role:"alert"},r)}}])&&i(y.prototype,m),h&&i(y,h),Object.defineProperty(y,"prototype",{writable:!1}),v}();h={id:null,className:null,style:null,text:null,severity:"info",content:null},(m="defaultProps")in(y=b)?Object.defineProperty(y,m,{value:h,enumerable:!0,configurable:!0,writable:!0}):y[m]=h;export{b as Message};
|