Line data Source code
1 : // @ts-check 2 : 3 : import Vue from "vue"; 4 : import PropertyMixin from "./PropertyMixin"; 5 : import BadgeButton from "../BadgeButton.vue"; 6 : import { getAttribute } from "../../utils/element"; 7 : 8 : /** 9 : * @typedef {{ value: HTMLInputElement }} Refs 10 : */ 11 : 12 : export default /** @type {V.Constructor<any, Refs>} */ (Vue).extend({ 13 : name: "PropertyNumber", 14 : components: { BadgeButton }, 15 : mixins: [ PropertyMixin ], 16 : /** @return {{ isFocused: boolean }} */ 17 3 : data() { return { isFocused: false }; }, 18 : computed: { 19 5 : min() { return getAttribute(this.property, "min"); }, 20 5 : max() { return getAttribute(this.property, "max"); } 21 : }, 22 : watch: { 23 3 : value() { this.$refs.value.value = this.value; } 24 : }, 25 : mounted() { 26 3 : this.$refs.value.value = this.value; 27 : }, 28 : methods: { 29 : /** @param {Event} event */ 30 : onInputClick(event) { 31 0 : event.stopPropagation(); 32 : }, 33 : onInputChange() { 34 0 : this.$store.commit("engine/updateState", 35 : { [this.name]: this.$refs.value.value }); 36 : }, 37 : doCreateRelation() { 38 : 39 : } 40 : } 41 : });