UNPKG

@nextcloud/vue

Version:
30 lines (29 loc) 2.39 kB
import "../assets/index32.css"; import { A as s } from "../chunks/actionText-6c35d3fc.mjs"; import { G as e } from "../chunks/GenRandomId-1e1b509a.mjs"; import l from "vue-material-design-icons/ArrowRight.vue"; import { n as o } from "../chunks/_plugin-vue2_normalizer-5b4c43a4.mjs"; const n = { name: "NcActionTextEditable", components: { ArrowRight: l }, mixins: [s], props: { id: { type: String, default: () => "action-" + e(), validator: (t) => t.trim() !== "" }, disabled: { type: Boolean, default: !1 }, value: { type: String, default: "" } }, emits: ["input", "update:value", "submit"], computed: { isFocusable() { return !this.disabled; }, computedId() { return e(); } }, methods: { onInput(t) { this.$emit("input", t), this.$emit("update:value", t.target.value); }, onSubmit(t) { if (t.preventDefault(), t.stopPropagation(), !this.disabled) this.$emit("submit", t); else return !1; } } }; var r = function() { var t = this, a = t._self._c; return a("li", { staticClass: "action", class: { "action--disabled": t.disabled } }, [a("span", { staticClass: "action-text-editable", on: { click: t.onClick } }, [t._t("icon", function() { return [a("span", { staticClass: "action-text-editable__icon", class: [t.isIconUrl ? "action-text-editable__icon--url" : t.icon], style: { backgroundImage: t.isIconUrl ? `url(${t.icon})` : null } })]; }), a("form", { ref: "form", staticClass: "action-text-editable__form", attrs: { disabled: t.disabled }, on: { submit: function(i) { return i.preventDefault(), t.onSubmit.apply(null, arguments); } } }, [a("input", { staticClass: "action-text-editable__submit", attrs: { id: t.id, type: "submit" } }), t.name ? a("label", { staticClass: "action-text-editable__name", attrs: { for: t.computedId } }, [t._v(" " + t._s(t.name) + " ")]) : t._e(), a("textarea", t._b({ class: ["action-text-editable__textarea", { focusable: t.isFocusable }], attrs: { id: t.computedId, disabled: t.disabled }, domProps: { value: t.value }, on: { input: t.onInput } }, "textarea", t.$attrs, !1)), a("label", { directives: [{ name: "show", rawName: "v-show", value: !t.disabled, expression: "!disabled" }], staticClass: "action-text-editable__label", attrs: { for: t.id } }, [a("ArrowRight", { attrs: { size: 20 } })], 1)])], 2)]); }, d = [], u = o(n, r, d, !1, null, "b0b05af8", null, null); const _ = u.exports; export { _ as default };