Line data Source code
1 : // @ts-check 2 : 3 : import Vue from "vue"; 4 : import BadgeButton from "../BadgeButton.vue"; 5 : 6 : /** 7 : * @typedef {any} EndEvent 8 : */ 9 : 10 1 : const component = /** @type {V.Constructor<any, any>} */ (Vue).extend({ 11 : name: "RelationEditValue", 12 : components: { BadgeButton }, 13 : props: { value: { type: String, default: "" } }, 14 : /** @return {{ current: any, showReset: boolean }} */ 15 : data() { 16 2 : return { current: "", showReset: false }; 17 : }, 18 : watch: { 19 : value() { 20 0 : this.current = this.value; 21 : } 22 : }, 23 : methods: { 24 : onEdit() { 25 0 : this.showReset = true; 26 0 : this.$emit("edit", this.current); 27 : }, 28 : /** 29 : * @param {string} value 30 : */ 31 : setValue(value) { 32 0 : this.current = value; 33 0 : this.onEdit(); 34 : }, 35 : doReset() { 36 0 : this.showReset = false; 37 0 : this.$emit("reset"); 38 : } 39 : } 40 : }); 41 : export default component;