Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | 1x 3x 4x 3x 1x 1x 1x 1x 1x 3x 1x 1x 1x 1x | // @ts-check import { get, has, invoke } from "lodash"; import InputError from "./InputError.vue"; import InputErrorMixin from "./InputErrorMixin"; import BaseKeepFocusMixin from "../mixins/BaseKeepFocusMixin"; import BaseFocusInOutMixin from "../mixins/BaseFocusInOutMixin"; import Vue from "vue"; const component = /** @type {V.Constructor<any, any>} */(Vue).extend({ name: "BaseInputFile", components: { InputError }, mixins: [ BaseKeepFocusMixin, BaseFocusInOutMixin, InputErrorMixin ], props: { value: { type: String, default: undefined }, inEdit: { type: Boolean, default: false }, noEditIcon: { type: Boolean, default: false } }, /** * @return {{ editValue: File|null, hasEditRequest: boolean }} */ data() { return { editValue: null, hasEditRequest: false }; }, computed: { /** * @returns {string} */ editName() { return get(this.editValue, [ "name" ], ""); }, /** * @return {boolean} */ showEditIcon() { return this.hasFocus && this.hasEditRequest; } }, watch: { /** * @param {boolean} v */ inEdit(v /*: boolean */) { Eif (v) { Iif (this.editValue) { // Force emit the event when we enter edit mode this.$emit("edit", this.editValue); } else { this.editValue = null; /* clear old editValue when entering edit */ } } this.keepFocusOnNextTick("input"); }, /** * @return {void} */ editValue: function() { this.$emit("edit", this.editValue); } }, mounted() { this.hasEditRequest = has(this.$listeners, "edit-request"); }, methods: { onFileChange() { this.editValue = get(this.$refs, [ "input", "files", 0 ], null); }, /** * @param {boolean} value */ emitEditRequest(value) { invoke(this.$refs, [ "input", "focus" ]); this.keepFocusOnNextTick("input"); this.$emit("edit-request", value); } } }); export default component; |