-
Notifications
You must be signed in to change notification settings - Fork 136
feat: Label added for FileInput dropzone #304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
0ee8e66
78ac82d
08ca958
971a2fa
ef7c501
a72e3cc
3c8fd8b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,32 +3,15 @@ | |||||||||||||||||||
| <div v-if="!dropzone"> | ||||||||||||||||||||
| <label> | ||||||||||||||||||||
| <span :class="labelClasses">{{ label }}</span> | ||||||||||||||||||||
| <input | ||||||||||||||||||||
| :class="fileInpClasses" | ||||||||||||||||||||
| :multiple="multiple" | ||||||||||||||||||||
| type="file" | ||||||||||||||||||||
| :accept="accept" | ||||||||||||||||||||
| @change="handleChange" | ||||||||||||||||||||
| > | ||||||||||||||||||||
| <input :class="fileInpClasses" :multiple="multiple" type="file" :accept="accept" @change="handleChange" /> | ||||||||||||||||||||
| </label> | ||||||||||||||||||||
| <slot /> | ||||||||||||||||||||
| </div> | ||||||||||||||||||||
| <div | ||||||||||||||||||||
| v-else | ||||||||||||||||||||
| class="flex items-center justify-center" | ||||||||||||||||||||
| @change="handleChange" | ||||||||||||||||||||
| @dragover="dragOverHandler" | ||||||||||||||||||||
| @drop="dropFileHandler" | ||||||||||||||||||||
| > | ||||||||||||||||||||
| <div v-else class="flex flex-col items-start justify-center" @change="handleChange" @dragover="dragOverHandler" @drop="dropFileHandler"> | ||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||
| <span v-if="label !== ''" :class="labelClasses">{{ label }}</span> | ||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||
| <label :class="dropzoneLabelClasses"> | ||||||||||||||||||||
| <div :class="dropzoneWrapClasses"> | ||||||||||||||||||||
| <svg | ||||||||||||||||||||
| aria-hidden="true" | ||||||||||||||||||||
| class="w-8 h-8 text-gray-500 dark:text-gray-400" | ||||||||||||||||||||
| fill="none" | ||||||||||||||||||||
| viewBox="0 0 20 16" | ||||||||||||||||||||
| xmlns="http://www.w3.org/2000/svg" | ||||||||||||||||||||
| > | ||||||||||||||||||||
| <svg aria-hidden="true" class="w-8 h-8 text-gray-500 dark:text-gray-400" fill="none" viewBox="0 0 20 16" xmlns="http://www.w3.org/2000/svg"> | ||||||||||||||||||||
| <path | ||||||||||||||||||||
| d="M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2" | ||||||||||||||||||||
| stroke-linecap="round" | ||||||||||||||||||||
|
|
@@ -46,12 +29,7 @@ | |||||||||||||||||||
| </div> | ||||||||||||||||||||
| <p v-else>File: {{ dropZoneText }}</p> | ||||||||||||||||||||
| </div> | ||||||||||||||||||||
| <input | ||||||||||||||||||||
| :multiple="multiple" | ||||||||||||||||||||
| type="file" | ||||||||||||||||||||
| :accept="accept" | ||||||||||||||||||||
| class="hidden" | ||||||||||||||||||||
| > | ||||||||||||||||||||
| <input :multiple="multiple" type="file" :accept="accept" class="hidden" /> | ||||||||||||||||||||
| </label> | ||||||||||||||||||||
| </div> | ||||||||||||||||||||
| </div> | ||||||||||||||||||||
|
|
@@ -67,8 +45,8 @@ interface FileInputProps { | |||||||||||||||||||
| label?: string | ||||||||||||||||||||
| modelValue?: File | File[] | null | ||||||||||||||||||||
| multiple?: boolean | ||||||||||||||||||||
| size?: string, | ||||||||||||||||||||
| accept?:string, | ||||||||||||||||||||
| size?: string | ||||||||||||||||||||
| accept?: string | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| const props = withDefaults(defineProps<FileInputProps>(), { | ||||||||||||||||||||
|
|
@@ -96,10 +74,10 @@ const dropZoneText = computed(() => { | |||||||||||||||||||
|
|
||||||||||||||||||||
| const emit = defineEmits(['update:modelValue']) | ||||||||||||||||||||
| const model = computed({ | ||||||||||||||||||||
| get () { | ||||||||||||||||||||
| get() { | ||||||||||||||||||||
| return props.modelValue | ||||||||||||||||||||
| }, | ||||||||||||||||||||
| set (val) { | ||||||||||||||||||||
| set(val) { | ||||||||||||||||||||
|
||||||||||||||||||||
| get() { | |
| return props.modelValue | |
| }, | |
| set (val) { | |
| set(val) { | |
| get () { | |
| return props.modelValue | |
| }, | |
| set (val) { |
Tools
GitHub Check: lint (18.x)
[failure] 77-77:
Missing space before function parentheses
[failure] 80-80:
Missing space before function parentheses
Uh oh!
There was an error while loading. Please reload this page.