UNPKG

@nextcloud/vue

Version:
2 lines (1 loc) 2.77 kB
var d=require("../assets/index57.css");const s=require("../chunks/index-12fa9b26.cjs"),r=require("./NcDashboardWidgetItem.cjs"),i=require("./NcEmptyContent.cjs"),a=require("vue-material-design-icons/Check.vue"),o=require("../chunks/l10n-46d0c1c0.cjs"),m=require("../chunks/_plugin-vue2_normalizer-764a4c12.cjs");const l={name:"NcDashboardWidget",components:{NcAvatar:s.NcAvatar,NcDashboardWidgetItem:r,NcEmptyContent:i,Check:a},props:{items:{type:Array,default:()=>[]},showMoreUrl:{type:String,default:""},showMoreLabel:{type:String,default:o.t("More items …")},loading:{type:Boolean,default:!1},itemMenu:{type:Object,default:()=>({})},showItemsAndEmptyContent:{type:Boolean,default:!1},emptyContentMessage:{type:String,default:""},halfEmptyContentMessage:{type:String,default:""}},computed:{handlers(){const t={};for(const e in this.itemMenu)t[e]=n=>{this.$emit(e,n)};return t},displayedItems(){const t=this.showMoreUrl&&this.items.length>=this.maxItemNumber?this.maxItemNumber-1:this.maxItemNumber;return this.items.slice(0,t)},showHalfEmptyContentArea(){return this.showItemsAndEmptyContent&&this.halfEmptyContentString&&this.items.length!==0},halfEmptyContentString(){return this.halfEmptyContentMessage||this.emptyContentMessage},maxItemNumber(){return this.showItemsAndEmptyContent?5:7},showMore(){return this.showMoreUrl&&this.items.length>=this.maxItemNumber}}};var u=function(){var t=this,e=t._self._c;return e("div",{staticClass:"dashboard-widget"},[t.showHalfEmptyContentArea?e("NcEmptyContent",{staticClass:"half-screen",attrs:{description:t.halfEmptyContentString},scopedSlots:t._u([{key:"icon",fn:function(){return[t._t("halfEmptyContentIcon",function(){return[e("Check")]})]},proxy:!0}],null,!0)}):t._e(),e("ul",t._l(t.displayedItems,function(n){return e("li",{key:n.id},[t._t("default",function(){return[e("NcDashboardWidgetItem",t._g(t._b({attrs:{"item-menu":t.itemMenu}},"NcDashboardWidgetItem",n,!1),t.handlers))]},{item:n})],2)}),0),t.loading?e("div",t._l(7,function(n){return e("div",{key:n,staticClass:"item-list__entry"},[e("NcAvatar",{staticClass:"item-avatar",attrs:{size:44}}),t._m(0,!0)],1)}),0):t.items.length===0?t._t("empty-content",function(){return[t.emptyContentMessage?e("NcEmptyContent",{attrs:{description:t.emptyContentMessage},scopedSlots:t._u([{key:"icon",fn:function(){return[t._t("emptyContentIcon")]},proxy:!0}],null,!0)}):t._e()]}):t.showMore?e("a",{staticClass:"more",attrs:{href:t.showMoreUrl,target:"_blank",tabindex:"0"}},[t._v(" "+t._s(t.showMoreLabel)+" ")]):t._e()],2)},h=[function(){var t=this,e=t._self._c;return e("div",{staticClass:"item__details"},[e("h3",[t._v(" ")]),e("p",{staticClass:"message"},[t._v("   ")])])}],c=m.normalizeComponent(l,u,h,!1,null,"1efcbeee",null,null);const p=c.exports;module.exports=p;