@@ -108,6 +108,83 @@ const getAllFileEntriesInDirectory = (directoryReader, path = '') =>
108
108
readDirectoryEntries ( )
109
109
} )
110
110
111
+ // --- Props ---
112
+
113
+ const props = makePropsConfigurable (
114
+ {
115
+ ...formControlProps ,
116
+ ...formCustomProps ,
117
+ ...formStateProps ,
118
+ ...formSizeProps ,
119
+ value : {
120
+ type : [ File , Array ] ,
121
+ default : null ,
122
+ validator ( value ) {
123
+ /* istanbul ignore next */
124
+ if ( value === '' ) {
125
+ warn ( VALUE_EMPTY_DEPRECATED_MSG , NAME_FORM_FILE )
126
+ return true
127
+ }
128
+ return isUndefinedOrNull ( value ) || isValidValue ( value )
129
+ }
130
+ } ,
131
+ accept : {
132
+ type : String ,
133
+ default : ''
134
+ } ,
135
+ // Instruct input to capture from camera
136
+ capture : {
137
+ type : Boolean ,
138
+ default : false
139
+ } ,
140
+ placeholder : {
141
+ type : String ,
142
+ default : 'No file chosen'
143
+ } ,
144
+ browseText : {
145
+ type : String ,
146
+ default : 'Browse'
147
+ } ,
148
+ dropPlaceholder : {
149
+ type : String ,
150
+ default : 'Drop files here'
151
+ } ,
152
+ noDropPlaceholder : {
153
+ type : String ,
154
+ default : 'Not allowed'
155
+ } ,
156
+ multiple : {
157
+ type : Boolean ,
158
+ default : false
159
+ } ,
160
+ directory : {
161
+ type : Boolean ,
162
+ default : false
163
+ } ,
164
+ // TODO:
165
+ // Should we deprecate this and only support flat file structures?
166
+ // Nested file structures are only supported when files are dropped
167
+ // A Chromium "bug" prevents `webkitEntries` from being populated
168
+ // on the file input's `change` event and is marked as "WontFix"
169
+ // Mozilla implemented the behavior the same way as Chromium
170
+ // See: https://bugs.chromium.org/p/chromium/issues/detail?id=138987
171
+ // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1326031
172
+ noTraverse : {
173
+ type : Boolean ,
174
+ default : false
175
+ } ,
176
+ noDrop : {
177
+ type : Boolean ,
178
+ default : false
179
+ } ,
180
+ fileNameFormatter : {
181
+ type : Function
182
+ // default: null
183
+ }
184
+ } ,
185
+ NAME_FORM_FILE
186
+ )
187
+
111
188
// @vue /component
112
189
export const BFormFile = /*#__PURE__*/ Vue . extend ( {
113
190
name : NAME_FORM_FILE ,
@@ -124,80 +201,7 @@ export const BFormFile = /*#__PURE__*/ Vue.extend({
124
201
prop : 'value' ,
125
202
event : 'input'
126
203
} ,
127
- props : makePropsConfigurable (
128
- {
129
- ...formControlProps ,
130
- ...formCustomProps ,
131
- ...formStateProps ,
132
- ...formSizeProps ,
133
- value : {
134
- type : [ File , Array ] ,
135
- default : null ,
136
- validator ( value ) {
137
- /* istanbul ignore next */
138
- if ( value === '' ) {
139
- warn ( VALUE_EMPTY_DEPRECATED_MSG , NAME_FORM_FILE )
140
- return true
141
- }
142
- return isUndefinedOrNull ( value ) || isValidValue ( value )
143
- }
144
- } ,
145
- accept : {
146
- type : String ,
147
- default : ''
148
- } ,
149
- // Instruct input to capture from camera
150
- capture : {
151
- type : Boolean ,
152
- default : false
153
- } ,
154
- placeholder : {
155
- type : String ,
156
- default : 'No file chosen'
157
- } ,
158
- browseText : {
159
- type : String ,
160
- default : 'Browse'
161
- } ,
162
- dropPlaceholder : {
163
- type : String ,
164
- default : 'Drop files here'
165
- } ,
166
- noDropPlaceholder : {
167
- type : String ,
168
- default : 'Not allowed'
169
- } ,
170
- multiple : {
171
- type : Boolean ,
172
- default : false
173
- } ,
174
- directory : {
175
- type : Boolean ,
176
- default : false
177
- } ,
178
- // TODO:
179
- // Should we deprecate this and only support flat file structures?
180
- // Nested file structures are only supported when files are dropped
181
- // A Chromium "bug" prevents `webkitEntries` from being populated
182
- // on the file input's `change` event and is marked as "WontFix"
183
- // Mozilla implemented the behavior the same way as Chromium
184
- // See: https://bugs.chromium.org/p/chromium/issues/detail?id=138987
185
- // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1326031
186
- noTraverse : {
187
- type : Boolean ,
188
- default : false
189
- } ,
190
- noDrop : {
191
- type : Boolean ,
192
- default : false
193
- } ,
194
- fileNameFormatter : {
195
- type : Function
196
- // default: null
197
- }
198
- } ,
199
- NAME_FORM_FILE
200
- ) ,
204
+ props,
201
205
data ( ) {
202
206
return {
203
207
files : [ ] ,
@@ -269,7 +273,7 @@ export const BFormFile = /*#__PURE__*/ Vue.extend({
269
273
} ,
270
274
computedFileNameFormatter ( ) {
271
275
const { fileNameFormatter } = this
272
- return fileNameFormatter . name !== ' default'
276
+ return fileNameFormatter . name !== props . fileNameFormatter . default . name
273
277
? fileNameFormatter
274
278
: this . defaultFileNameFormatter
275
279
} ,
0 commit comments