fix(UI): file uploader in table filler

This commit is contained in:
Fabio Di Stasio 2021-02-17 14:47:15 +01:00
parent 5b21d17f3a
commit b5a828309f
2 changed files with 20 additions and 8 deletions

View File

@ -72,6 +72,7 @@ export default {
background-color: $bg-color-gray;
transition: background 0.2s, border 0.2s, box-shadow 0.2s, color 0.2s;
position: relative;
flex: 1 1 auto;
> span {
padding: 0.25rem 0.4rem;

View File

@ -1,5 +1,5 @@
<template>
<fieldset class="input-group mb-0" :disabled="!fakerGroups.length">
<fieldset class="input-group mb-0">
<select
v-model="selectedGroup"
class="form-select"
@ -50,13 +50,13 @@
:type="inputProps().type"
:disabled="!isChecked"
>
<input
<BaseUploadInput
v-else-if="inputProps().type === 'file'"
ref="formInput"
class="form-input"
type="file"
:disabled="!isChecked"
>
:value="selectedValue"
:message="$t('word.browse')"
@clear="clearValue"
@change="filesChange($event)"
/>
<input
v-else-if="inputProps().type === 'number'"
ref="formInput"
@ -92,13 +92,15 @@
<script>
import { mask } from 'vue-the-mask';
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT } from 'common/fieldTypes';
import BaseUploadInput from '@/components/BaseUploadInput';
import ForeignKeySelect from '@/components/ForeignKeySelect';
import FakerMethods from 'common/FakerMethods';
export default {
name: 'FakerSelect',
components: {
ForeignKeySelect
ForeignKeySelect,
BaseUploadInput
},
directives: {
mask
@ -208,6 +210,15 @@ export default {
getKeyUsage (keyName) {
return this.keyUsage.find(key => key.field === keyName);
},
filesChange (event) {
const { files } = event.target;
if (!files.length) return;
this.selectedValue = files[0].path;
},
clearValue () {
this.selectedValue = '';
},
onChange () {
this.$emit('update:value', {
group: this.selectedGroup,