UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

3 lines 3.12 kB
/* @license */ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`kendo.core.min.js`),require(`kendo.icons.min.js`)):typeof define==`function`&&define.amd?define([`exports`,`kendo.core.min`,`kendo.icons.min`],t):(e=typeof globalThis<`u`?globalThis:e||self,t((e.kendo=e.kendo||{},e.kendo._globals=e.kendo._globals||{},e.kendo._globals.Avatar={}),e.kendo._globals.Core,e.kendo._globals.Icons))})(this,function(e,t,n){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let r={id:`avatar`,name:`Avatar`,category:`web`,description:`The Avatar component represents an icon, text, or image rendered in a styled container.`,depends:[`core`]};(function(e,t){var n=window.kendo,r=n.ui.Widget,i=`-`,a=`.k-icon,.k-svg-icon`,o={widget:`k-widget`,avatar:`k-avatar`,bordered:`k-avatar-bordered`},s={icon:`icon`,image:`image`,text:`text`},c=r.extend({init:function(e,t){var n=this;t||={},r.fn.init.call(n,e,t),this._fromMarkup(),this._wrapper(),this._markupContent&&this._markupContent.length>0?this._contentFromMarkup():this._content()},options:{name:`Avatar`,alt:null,border:!1,className:null,fillMode:t,icon:null,image:null,rounded:t,size:t,style:null,text:null,themeColor:t,type:s.text},events:[],setOptions:function(t){var n=this.options,i=this.wrapper,a=e.extend({},n,t);r.fn.setOptions.call(this,t),a[a.type]||(n=this._optionsFromWrapper(n)),a.border===!1&&i.removeClass(o.bordered),i.empty(),this.options=n,this._wrapper(),this._content()},_content:function(){var t=this.wrapper.find(`> span`),r=this.options,i=r.type,a;i===s.icon?a=e(n.html.renderIcon({icon:r.icon})):i===s.image?(a=e(`<img src='`+r.image+`'>`),r.alt&&a.attr(`alt`,r.alt)):i===s.text&&(a=e(`<span>`+r.text+`</span>`)),t.append(a)},_contentFromMarkup:function(){this.wrapper.find(`> span`).first().append(this._markupContent)},_fromMarkup:function(){var e=this.element,t=this.options,n,r;e.children().slice(1).remove(),n=e.children(`img`),r=e.children(a),n.length>0?(t.type=s.image,this._markupContent=n.first()):r.length>0?(t.type=s.icon,this._markupContent=r.first()):e.children().length>0&&(t.type=s.text,this._markupContent=e.children())},_optionsFromWrapper:function(e){var t=this.wrapper,n,r;return e.type===s.text?e.text=t.text().trim():e.type===s.icon?(n=t.find(a).attr(`class`).split(/\s+/),n.forEach(function(t){t.indexOf(`k-i-`)===0?e.icon=t.substring(4):t.indexOf(`k-svg-i-`)===0&&(e.icon=t.replace(/^k-svg-i-/,``))})):e.type===s.image&&(r=t.find(`img`),e.image=r.attr(`src`),r.attr(`alt`)&&(e.alt=r.attr(`alt`))),e},_wrapper:function(){var t=this.element,n=this.options,r=e(`<span>`);this.wrapper=t,t.addClass(o.avatar),this._applyCssClasses(),n.border&&t.addClass(o.bordered),n.style&&t.css(n.style),n.className&&t.addClass(n.className),r.addClass(o.avatar+i+n.type),t.prepend(r)}});n.cssProperties.registerPrefix(`Avatar`,`k-avatar-`),n.cssProperties.registerValues(`Avatar`,[{prop:`rounded`,values:n.cssProperties.roundedValues.concat([[`full`,`full`]])}]),n.ui.plugin(c)})(window.kendo.jQuery);var i=kendo;e.__meta__=r,e.default=i}); //# sourceMappingURL=kendo.avatar.min.js.map