+9
-7
lines changedFilter options
+9
-7
lines changed Original file line number Diff line number Diff line change
@@ -12,11 +12,17 @@ import formStateMixin from '../../mixins/form-state'
12
12
import idMixin from '../../mixins/id'
13
13
import normalizeSlotMixin from '../../mixins/normalize-slot'
14
14
15
+
// --- Constants ---
16
+
15
17
const NAME = 'BFormFile'
16
18
17
19
const VALUE_EMPTY_DEPRECATED_MSG =
18
20
'Setting "value"/"v-model" to an empty string for reset is deprecated. Set to "null" instead.'
19
21
22
+
// --- Helper methods ---
23
+
24
+
const isValidValue = value => isFile(value) || (isArray(value) && value.every(v => isValidValue(v)))
25
+
20
26
// @vue/component
21
27
export const BFormFile = /*#__PURE__*/ Vue.extend({
22
28
name: NAME,
@@ -34,17 +40,13 @@ export const BFormFile = /*#__PURE__*/ Vue.extend({
34
40
value: {
35
41
type: [File, Array],
36
42
default: null,
37
-
validator: val => {
43
+
validator: value => {
38
44
/* istanbul ignore next */
39
-
if (val === '') {
45
+
if (value === '') {
40
46
warn(VALUE_EMPTY_DEPRECATED_MSG, NAME)
41
47
return true
42
48
}
43
-
return (
44
-
isUndefinedOrNull(val) ||
45
-
isFile(val) ||
46
-
(isArray(val) && (val.length === 0 || val.every(isFile)))
47
-
)
49
+
return isUndefinedOrNull(value) || isValidValue(value)
48
50
}
49
51
},
50
52
accept: {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4