import '../assets/NcDashboardWidgetItem-B8_6-_k8.css'; import { N as NcAvatar } from "./NcAvatar-BjwyJw34.mjs"; import { N as NcActions } from "./NcActions-D3hGxwlc.mjs"; import { N as NcActionButton } from "./NcActionButton-CEysTg4c.mjs"; import { n as normalizeComponent } from "./_plugin-vue2_normalizer-DU4iP6Vu.mjs"; const _sfc_main = { name: "NcDashboardWidgetItem", components: { NcAvatar, NcActions, NcActionButton }, props: { /** * The item id (optional) */ id: { type: [String, Number], default: void 0 }, /** * The item element is a link to this URL (optional) */ targetUrl: { type: String, default: void 0 }, /** * Where to get the avatar image. (optional) Used if avatarUsername is not defined. */ avatarUrl: { type: String, default: void 0 }, /** * Name to provide to the Avatar. (optional) Used if avatarUrl is not defined. */ avatarUsername: { type: String, default: void 0 }, /** * Is the avatarUsername not a user's name? (optional, false by default) */ avatarIsNoUser: { type: Boolean, default: false }, /** * Small icon to display on the bottom-right corner of the avatar (optional) */ overlayIconUrl: { type: String, default: void 0 }, /** * Item main text (mandatory) */ mainText: { type: String, required: true }, /** * Item subline text (optional) */ subText: { type: String, default: "" }, /** * An object containing context menu entries that will be displayed for each items (optional) */ itemMenu: { type: Object, default: () => { return {}; } }, /** * Specify whether the 3 dot menu is forced when only one action is present */ forceMenu: { type: Boolean, default: true } }, data() { return { hovered: false }; }, computed: { item() { return { id: this.id, targetUrl: this.targetUrl, avatarUrl: this.avatarUrl, avatarUsername: this.avatarUsername, overlayIconUrl: this.overlayIconUrl, mainText: this.mainText, subText: this.subText }; }, gotMenu() { return Object.keys(this.itemMenu).length !== 0 || !!this.$slots.actions; }, gotOverlayIcon() { return this.overlayIconUrl && this.overlayIconUrl !== ""; } }, methods: { onLinkClick(event) { if (event.target.closest(".action-item")) { event.preventDefault(); } } } }; var _sfc_render = function render() { var _vm = this, _c = _vm._self._c; return _c("div", { on: { "mouseover": function($event) { _vm.hovered = true; }, "mouseleave": function($event) { _vm.hovered = false; } } }, [_c(_vm.targetUrl ? "a" : "div", { tag: "component", class: { "item-list__entry": true, "item-list__entry--has-actions-menu": _vm.gotMenu }, attrs: { "href": _vm.targetUrl || void 0, "target": _vm.targetUrl ? "_blank" : void 0 }, on: { "click": _vm.onLinkClick } }, [_vm._t("avatar", function() { return [_c("NcAvatar", { staticClass: "item-avatar", attrs: { "size": 44, "url": _vm.avatarUrl, "user": _vm.avatarUsername, "is-no-user": _vm.avatarIsNoUser, "show-user-status": !_vm.gotOverlayIcon } })]; }, { "avatarUrl": _vm.avatarUrl, "avatarUsername": _vm.avatarUsername }), _vm.overlayIconUrl ? _c("img", { staticClass: "item-icon", attrs: { "alt": "", "src": _vm.overlayIconUrl } }) : _vm._e(), _c("div", { staticClass: "item__details" }, [_c("h3", { attrs: { "title": _vm.mainText } }, [_vm._v(" " + _vm._s(_vm.mainText) + " ")]), _vm.subText !== "" ? _c("span", { staticClass: "message", attrs: { "title": _vm.subText } }, [_vm._v(" " + _vm._s(_vm.subText) + " ")]) : _vm._e()]), _vm.gotMenu ? _c("NcActions", { attrs: { "force-menu": _vm.forceMenu } }, [_vm._t("actions", function() { return _vm._l(_vm.itemMenu, function(m, menuItemId) { return _c("NcActionButton", { key: menuItemId, attrs: { "icon": m.icon, "close-after-click": true }, on: { "click": function($event) { $event.preventDefault(); $event.stopPropagation(); return _vm.$emit(menuItemId, _vm.item); } } }, [_vm._v(" " + _vm._s(m.text) + " ")]); }); })], 2) : _vm._e()], 2)], 1); }; var _sfc_staticRenderFns = []; var __component__ = /* @__PURE__ */ normalizeComponent( _sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "db766935" ); const NcDashboardWidgetItem = __component__.exports; export { NcDashboardWidgetItem as N };