2 lines
3.3 KiB
JavaScript
2 lines
3.3 KiB
JavaScript
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(e);function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,t){return i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(e,t)}function l(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&&i(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 s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(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 s(e)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},u(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,h,m,b=function(r){l(b,e.Component);var i,p,s,y,h,m=(i=b,p=f(),function(){var e,t=u(i);if(p){var r=u(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return c(this,e)});function b(){return n(this,b),m.apply(this,arguments)}return s=b,(y=[{key:"renderContent",value:function(){var e=this;return this.props.label?o.default.createElement("span",{className:"p-avatar-text"},this.props.label):this.props.icon?t.IconUtils.getJSXIcon(this.props.icon,{className:"p-avatar-icon"},{props:this.props}):this.props.image?o.default.createElement("img",{src:this.props.image,alt:this.props.imageAlt,onError:function(t){e.props.onImageError&&e.props.onImageError(t)}}):null}},{key:"render",value:function(){var e=t.classNames("p-avatar p-component",{"p-avatar-image":null!=this.props.image,"p-avatar-circle":"circle"===this.props.shape,"p-avatar-lg":"large"===this.props.size,"p-avatar-xl":"xlarge"===this.props.size,"p-avatar-clickable":!!this.props.onClick},this.props.className),r=this.props.template?t.ObjectUtils.getJSXElement(this.props.template,this.props):this.renderContent();return o.default.createElement("div",{className:e,style:this.props.style,onClick:this.props.onClick},r,this.props.children)}}])&&a(s.prototype,y),h&&a(s,h),Object.defineProperty(s,"prototype",{writable:!1}),b}();m={label:null,icon:null,image:null,size:"normal",shape:"square",style:null,className:null,template:null,imageAlt:"avatar",onImageError:null,onClick:null},(h="defaultProps")in(y=b)?Object.defineProperty(y,h,{value:m,enumerable:!0,configurable:!0,writable:!0}):y[h]=m,exports.Avatar=b;
|