@nextcloud/vue
Version:
Nextcloud vue components
52 lines (51 loc) • 3.26 kB
JavaScript
import "../assets/index18.css";
import { N as s } from "../chunks/index-7aa3fc24.mjs";
import r from "./NcDashboardWidgetItem.mjs";
import o from "./NcEmptyContent.mjs";
import a from "vue-material-design-icons/Check.vue";
import { t as i } from "../chunks/l10n-9a5a6afc.mjs";
import { n as m } from "../chunks/_plugin-vue2_normalizer-5b4c43a4.mjs";
const l = { name: "NcDashboardWidget", components: { NcAvatar: s, NcDashboardWidgetItem: r, NcEmptyContent: o, Check: a }, props: { items: { type: Array, default: () => [] }, showMoreUrl: { type: String, default: "" }, showMoreLabel: { type: String, default: i("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 h = 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);
}, u = [function() {
var t = this, e = t._self._c;
return e("div", { staticClass: "item__details" }, [e("h3", [t._v(" ")]), e("p", { staticClass: "message" }, [t._v(" ")])]);
}], p = m(l, h, u, !1, null, "1efcbeee", null, null);
const M = p.exports;
export {
M as default
};