bootstrap-vue-wrapper 1.7.13 → 1.8.1
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 +4 -4
- package/src/components/bs-radio/BsRadio.vue +118 -0
- package/src/index.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bootstrap-vue-wrapper",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Bootstrap 5 components in Vue3 warapper.",
|
|
5
5
|
"author": "Gabor Zemko <gaborzemko@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/zemkogabor/bootstrap-vue-wrapper",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
},
|
|
13
13
|
"main": "src/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"bootstrap": "^5.1",
|
|
16
|
-
"vue": "^3.2",
|
|
17
|
-
"vue-router": "^4.0"
|
|
15
|
+
"bootstrap": "^5.1.0",
|
|
16
|
+
"vue": "^3.2.0",
|
|
17
|
+
"vue-router": "^4.0.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"eslint": "^8.8.0",
|
|
@@ -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>
|
package/src/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import BsTable from './components/bs-table/BsTable.vue'
|
|
|
8
8
|
import BsToast from './components/bs-toast/BsToast.vue'
|
|
9
9
|
import BsModal from './components/bs-modal/BsModal.vue'
|
|
10
10
|
import BsSelect from './components/bs-select/BsSelect.vue'
|
|
11
|
+
import BsRadio from './components/bs-radio/BsRadio.vue'
|
|
11
12
|
import Validator from './mixins/validator.js'
|
|
12
13
|
|
|
13
14
|
export {
|
|
@@ -21,5 +22,6 @@ export {
|
|
|
21
22
|
BsToast,
|
|
22
23
|
BsModal,
|
|
23
24
|
BsSelect,
|
|
25
|
+
BsRadio,
|
|
24
26
|
Validator,
|
|
25
27
|
}
|