kill BaseCheckbox

This commit is contained in:
ogerly 2021-06-11 12:11:35 +02:00
parent 7eab86357e
commit 6b5a65525a
4 changed files with 0 additions and 150 deletions

View File

@ -1,78 +0,0 @@
<template>
<div
class="custom-control custom-checkbox"
:class="[{ disabled: disabled }, { [`custom-checkbox-${type}`]: type }, inlineClass]"
>
<input
:id="cbId"
class="custom-control-input"
:class="inputClasses"
type="checkbox"
:disabled="disabled"
v-model="model"
/>
<label :for="cbId" class="custom-control-label">
<slot>
<span v-if="inline">&nbsp;</span>
</slot>
</label>
</div>
</template>
<script>
export default {
name: 'base-checkbox',
model: {
prop: 'checked',
},
props: {
checked: {
type: [Array, Boolean],
description: 'Whether checkbox is checked',
},
disabled: {
type: Boolean,
description: 'Whether checkbox is disabled',
},
inline: {
type: Boolean,
description: 'Whether checkbox is inline',
},
inputClasses: {
type: [String, Object, Array],
description: 'Checkbox input classes',
},
type: {
type: String,
description: 'Checkbox type (e.g info, danger etc)',
},
},
data() {
return {
cbId: '',
touched: false,
}
},
computed: {
model: {
get() {
return this.checked
},
set(check) {
if (!this.touched) {
this.touched = true
}
this.$emit('input', check)
},
},
inlineClass() {
if (this.inline) {
return `form-check-inline`
}
return ''
},
},
created() {
this.cbId = Math.random().toString(16).slice(2)
},
}
</script>

View File

@ -1,64 +0,0 @@
<template>
<div class="custom-control custom-radio" :class="[inlineClass, { disabled: disabled }]">
<input
:id="cbId"
class="custom-control-input"
type="radio"
:disabled="disabled"
:value="name"
v-model="model"
/>
<label :for="cbId" class="custom-control-label">
<slot>
<span v-if="inline">&nbsp;</span>
</slot>
</label>
</div>
</template>
<script>
export default {
name: 'base-radio',
props: {
name: {
type: [String, Number],
description: 'Radio label',
},
disabled: {
type: Boolean,
description: 'Whether radio is disabled',
},
value: {
type: [String, Boolean],
description: 'Radio value',
},
inline: {
type: Boolean,
description: 'Whether radio is inline',
},
},
data() {
return {
cbId: '',
}
},
computed: {
model: {
get() {
return this.value
},
set(value) {
this.$emit('input', value)
},
},
inlineClass() {
if (this.inline) {
return `form-check-inline`
}
return ''
},
},
created() {
this.cbId = Math.random().toString(16).slice(2)
},
}
</script>

View File

@ -1,5 +1,3 @@
import BaseCheckbox from './Inputs/BaseCheckbox.vue'
import BaseRadio from './Inputs/BaseRadio.vue'
import BaseInput from './Inputs/BaseInput.vue'
import Badge from './Badge'
import BaseButton from './BaseButton.vue'
@ -23,9 +21,7 @@ import BaseSlider from './BaseSlider.vue'
import SidebarPlugin from './SidebarPlugin'
export {
BaseCheckbox,
Badge,
BaseRadio,
BaseInput,
Card,
StatsCard,

View File

@ -5,8 +5,6 @@ import Modal from '@/components/Modal.vue'
import StatsCard from '@/components/Cards/StatsCard.vue'
import BaseButton from '@/components/BaseButton.vue'
import Badge from '@/components/Badge.vue'
import BaseCheckbox from '@/components/Inputs/BaseCheckbox.vue'
import BaseRadio from '@/components/Inputs/BaseRadio'
import BaseNav from '@/components/Navbar/BaseNav'
import { ValidationProvider, ValidationObserver } from 'vee-validate'
@ -15,11 +13,9 @@ const GlobalComponents = {
install(Vue) {
Vue.component(Badge.name, Badge)
Vue.component(BaseButton.name, BaseButton)
Vue.component(BaseCheckbox.name, BaseCheckbox)
Vue.component(BaseInput.name, BaseInput)
Vue.component(BaseDropdown.name, BaseDropdown)
Vue.component(BaseNav.name, BaseNav)
Vue.component(BaseRadio.name, BaseRadio)
Vue.component(Card.name, Card)
Vue.component(Modal.name, Modal)
Vue.component(StatsCard.name, StatsCard)