diff --git a/ui/components/controls/Autocomplete.vue b/ui/components/controls/Autocomplete.vue index b3de9974..2f4b318b 100644 --- a/ui/components/controls/Autocomplete.vue +++ b/ui/components/controls/Autocomplete.vue @@ -57,6 +57,7 @@ export default { }, filter() { // return a function that filters list suggestions based on input + return Awesomplete.FILTER_CONTAINS } } }; diff --git a/ui/components/controls/Base.vue b/ui/components/controls/Base.vue index 1c510ec7..24ddaf3f 100644 --- a/ui/components/controls/Base.vue +++ b/ui/components/controls/Base.vue @@ -8,7 +8,7 @@ export default { }, props: { docfield: Object, - value: [String, Number, Array], + value: [String, Number, Array, FileList], onlyInput: { type: Boolean, default: false @@ -93,6 +93,9 @@ export default { const isValid = await this.validate(value); this.$refs.input.setCustomValidity(isValid === false ? 'error' : ''); this.$emit('change', value); + }, + getValueFromInput(e) { + }, validate() { return true; diff --git a/ui/components/controls/File.vue b/ui/components/controls/File.vue index 95a3d8f6..7537ac7d 100644 --- a/ui/components/controls/File.vue +++ b/ui/components/controls/File.vue @@ -10,7 +10,7 @@ export default { }, methods: { getWrapperElement(h) { - let fileName = 'Choose a file..'; + let fileName = this._('Choose a file..'); if (this.$refs.input && this.$refs.input.files.length) { fileName = this.$refs.input.files[0].name; @@ -27,11 +27,11 @@ export default { }); return h('div', { - class: ['form-group', ...this.wrapperClass], - attrs: { + class: ['form-group', ...this.wrapperClass], + attrs: { 'data-fieldname': this.docfield.fieldname - } - }, [this.getLabelElement(h), this.getInputElement(h), fileButton]); + } + }, [this.getLabelElement(h), this.getInputElement(h), fileButton]); }, getInputAttrs() { return { @@ -39,9 +39,18 @@ export default { type: 'file', value: this.value, required: this.docfield.required, - disabled: this.disabled - } + disabled: this.disabled, + webkitdirectory: this.docfield.directory, + directory: this.docfield.directory + }; + }, + getInputListeners() { + return { + change: e => { + this.handleChange(e.target.files); + } + }; } } -} +};