@nextcloud/vue
Version:
Nextcloud vue components
26 lines (25 loc) • 1.99 kB
JavaScript
import "../assets/index40.css";
import { N as a } from "../chunks/NcInputConfirmCancel-c440e1b1.mjs";
import i from "./NcLoadingIcon.mjs";
import { n as l } from "../chunks/_plugin-vue2_normalizer-5b4c43a4.mjs";
const o = { name: "NcAppNavigationNewItem", components: { NcInputConfirmCancel: a, NcLoadingIcon: i }, props: { name: { type: String, required: !0 }, icon: { type: String, default: "" }, loading: { type: Boolean, default: !1 }, editLabel: { type: String, default: "" }, editPlaceholder: { type: String, default: "" } }, emits: ["new-item"], data() {
return { newItemValue: "", newItemActive: !1 };
}, methods: { handleNewItem() {
this.loading || (this.newItemActive = !0, this.$nextTick(() => {
this.$refs.newItemInput.focusInput();
}));
}, cancelNewItem() {
this.newItemActive = !1;
}, handleNewItemDone() {
this.$emit("new-item", this.newItemValue), this.newItemValue = "", this.newItemActive = !1;
} } };
var c = function() {
var e = this, t = e._self._c;
return t("li", { staticClass: "app-navigation-entry", class: { "app-navigation-entry--newItemActive": e.newItemActive } }, [t("button", { staticClass: "app-navigation-entry-button", on: { click: e.handleNewItem } }, [t("span", { staticClass: "app-navigation-entry-icon", class: { [e.icon]: !e.loading } }, [e.loading ? t("NcLoadingIcon") : e._t("icon")], 2), e.newItemActive ? e._e() : t("span", { staticClass: "app-navigation-new-item__name", attrs: { title: e.name } }, [e._v(" " + e._s(e.name) + " ")]), e.newItemActive ? t("span", { staticClass: "newItemContainer" }, [t("NcInputConfirmCancel", { ref: "newItemInput", attrs: { placeholder: e.editPlaceholder !== "" ? e.editPlaceholder : e.name }, on: { cancel: e.cancelNewItem, confirm: e.handleNewItemDone }, model: { value: e.newItemValue, callback: function(n) {
e.newItemValue = n;
}, expression: "newItemValue" } })], 1) : e._e()])]);
}, s = [], m = l(o, c, s, !1, null, null, null, null);
const w = m.exports;
export {
w as default
};