@nextcloud/vue
Version:
Nextcloud vue components
25 lines (24 loc) • 1.36 kB
JavaScript
import "../assets/index16.css";
import { N as i, F as e } from "../chunks/index-cd3f1f8f.mjs";
import { n as a } from "../chunks/_plugin-vue2_normalizer-5b4c43a4.mjs";
const h = { name: "NcEllipsisedOption", components: { NcHighlight: i }, props: { name: { type: String, default: "" }, search: { type: String, default: "" } }, computed: { needsTruncate() {
return this.name && this.name.length >= 10;
}, split() {
return this.name.length - Math.min(Math.floor(this.name.length / 2), 10);
}, part1() {
return this.needsTruncate ? this.name.slice(0, this.split) : this.name;
}, part2() {
return this.needsTruncate ? this.name.slice(this.split) : "";
}, highlight1() {
return this.search ? e(this.name, this.search) : [];
}, highlight2() {
return this.highlight1.map((t) => ({ start: t.start - this.split, end: t.end - this.split }));
} } };
var r = function() {
var t = this, s = t._self._c;
return s("span", { staticClass: "name-parts", attrs: { title: t.name } }, [s("NcHighlight", { staticClass: "name-parts__first", attrs: { text: t.part1, search: t.search, highlight: t.highlight1 } }), t.part2 ? s("NcHighlight", { staticClass: "name-parts__last", attrs: { text: t.part2, search: t.search, highlight: t.highlight2 } }) : t._e()], 1);
}, n = [], l = a(h, r, n, !1, null, "08c4259e", null, null);
const m = l.exports;
export {
m as default
};