bootstrap-vue-wrapper 1.7.14 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="form-check" :class="classContainer">
|
|
3
|
+
<input
|
|
4
|
+
:id="id"
|
|
5
|
+
ref="validationTarget"
|
|
6
|
+
:value="modelValue"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
type="radio"
|
|
9
|
+
class="form-check-input"
|
|
10
|
+
:checked="isChecked"
|
|
11
|
+
:aria-describedby="hint !== null ? getHintId() : null"
|
|
12
|
+
@input="onInput"
|
|
13
|
+
@invalid="onInvalid"
|
|
14
|
+
>
|
|
15
|
+
<label
|
|
16
|
+
v-if="label !== null"
|
|
17
|
+
:for="id"
|
|
18
|
+
class="form-check-label"
|
|
19
|
+
v-text="label"
|
|
20
|
+
/>
|
|
21
|
+
<div
|
|
22
|
+
v-if="invalidMessage !== null && !hideValidationMessage"
|
|
23
|
+
class="invalid-feedback"
|
|
24
|
+
v-text="invalidMessage"
|
|
25
|
+
/>
|
|
26
|
+
<div
|
|
27
|
+
v-if="hint !== null"
|
|
28
|
+
:id="getHintId()"
|
|
29
|
+
class="form-text"
|
|
30
|
+
v-text="hint"
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
import validator from '../../mixins/validator.js'
|
|
37
|
+
|
|
38
|
+
export default {
|
|
39
|
+
name: 'BsRadio',
|
|
40
|
+
mixins: [validator],
|
|
41
|
+
props: {
|
|
42
|
+
/**
|
|
43
|
+
* Radio value
|
|
44
|
+
*/
|
|
45
|
+
value: {
|
|
46
|
+
type: [String, Number],
|
|
47
|
+
default: null,
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Value for v-model
|
|
51
|
+
*/
|
|
52
|
+
modelValue: {
|
|
53
|
+
type: [String, Number],
|
|
54
|
+
default: null,
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Html id
|
|
58
|
+
*/
|
|
59
|
+
id: {
|
|
60
|
+
type: String,
|
|
61
|
+
required: true,
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Label for input
|
|
65
|
+
*/
|
|
66
|
+
label: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: null,
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* Attribute hint
|
|
72
|
+
*/
|
|
73
|
+
hint: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: null,
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* Input container div class.
|
|
79
|
+
*/
|
|
80
|
+
classContainer: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: null,
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* If this is true the validation message does not appear.
|
|
86
|
+
*/
|
|
87
|
+
hideValidationMessage: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: false,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
emits: ['update:modelValue'],
|
|
93
|
+
computed: {
|
|
94
|
+
/**
|
|
95
|
+
* Radio is checked or not.
|
|
96
|
+
*/
|
|
97
|
+
isChecked() {
|
|
98
|
+
return this.modelValue === this.value
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
methods: {
|
|
102
|
+
/**
|
|
103
|
+
* Hint id is generated
|
|
104
|
+
*/
|
|
105
|
+
getHintId() {
|
|
106
|
+
return this.id + 'Hint'
|
|
107
|
+
},
|
|
108
|
+
/**
|
|
109
|
+
* On input event
|
|
110
|
+
*
|
|
111
|
+
* @param event
|
|
112
|
+
*/
|
|
113
|
+
onInput(event) {
|
|
114
|
+
this.$emit('update:modelValue', this.value)
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
</script>
|