Skip to content

Commit 53e10f6

Browse files
committed
refactor: CFormFile: reduce custom prop logic
Reduce custom prop to boolean, and add new placeholder property
1 parent a5a7747 commit 53e10f6

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

src/components/Form/CFormFile.vue

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
:for="safeId"
2727
class="c-custom-file-label"
2828
>
29-
{{placeholder}}
29+
{{computedPlaceholder}}
3030
</label>
3131
</template>
3232

@@ -71,7 +71,7 @@ export default {
7171
// default: null
7272
// },
7373
// multiple: Boolean,
74-
// custom: [Boolean, String],
74+
// custom: Boolean,
7575
// addInputClasses: String,
7676
// addLabelClasses: String,
7777
// addWrapperClasses: String,
@@ -82,18 +82,12 @@ export default {
8282
}
8383
},
8484
computed: {
85-
placeholder () {
86-
return typeof this.custom === 'string' ?
87-
this.custom : this.multiple ?
88-
'Choose files...' : 'Choose file...'
85+
computedPlaceholder () {
86+
return this.placeholder || `Choose file${this.multiple ?'s':''}...`
8987
},
9088
// classesComputedProps mixin
91-
haveCustomSize () {
92-
return ['','sm','lg'].includes(this.size) &&
93-
Boolean(this.size && !this.custom)
94-
},
9589
// haveCustomSize () {
96-
// return ['','sm','lg'].includes(this.size) && Boolean(this.size)
90+
// return ['sm','lg'].includes(this.size)
9791
// },
9892
computedClasses () {
9993
return [

src/components/Form/formProps.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ const textInputsProps = {
4444
}
4545
}
4646

47-
// Html props: disabled, required, accept, id
47+
// Html props: disabled, required, accept, id, placeholder
4848
export const formFileProps = Object.assign(
4949
{}, formGroupAlwaysSharedProps, props, {
50-
custom: [Boolean, String],
50+
custom: Boolean,
51+
placeholder: String,
5152
multiple: Boolean
5253
})
5354

@@ -91,6 +92,6 @@ export const formCheckboxProps = Object.assign(
9192
type: [String, Number],
9293
default: undefined
9394
},
94-
custom: [Boolean, String],
95+
custom: Boolean,
9596
inline: Boolean
9697
})

0 commit comments

Comments
 (0)