Skip to content

Commit

Permalink
fix(NcCheckboxContent): correctly check default slot
Browse files Browse the repository at this point in the history
Signed-off-by: Raimund Schlüßler <[email protected]>
  • Loading branch information
raimund-schluessler committed Jan 11, 2024
1 parent b85d4ce commit 7fa5106
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/NcCheckboxRadioSwitch/NcCheckboxContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
:class="{
['checkbox-content-' + type]: true,
'checkbox-content--button-variant': buttonVariant,
'checkbox-content--has-text': !!$slots.default,
'checkbox-content--has-text': isSlotPopulated($slots.default()),
}">
<!--
label can't be used here because of shift+click firefox bug
Expand All @@ -53,7 +53,7 @@
</slot>
</span>

<span v-if="$slots.default" :class="['checkbox-content__text', textClass]">
<span v-if="isSlotPopulated($slots.default())" :class="['checkbox-content__text', textClass]">
<!-- @slot The checkbox/radio label -->
<slot />
</span>
Expand All @@ -70,6 +70,7 @@ import ToggleSwitchOff from 'vue-material-design-icons/ToggleSwitchOff.vue'
import ToggleSwitch from 'vue-material-design-icons/ToggleSwitch.vue'

import NcLoadingIcon from '../NcLoadingIcon/index.js'
import isSlotPopulated from '../../utils/isSlotPopulated.ts'

export const TYPE_CHECKBOX = 'checkbox'
export const TYPE_RADIO = 'radio'
Expand Down Expand Up @@ -166,6 +167,10 @@ export default {
},
},

methods: {
isSlotPopulated,
},

computed: {

Check warning on line 174 in src/components/NcCheckboxRadioSwitch/NcCheckboxContent.vue

View workflow job for this annotation

GitHub Actions / eslint

The "computed" property should be above the "methods" property on line 170
isButtonType() {
return this.type === TYPE_BUTTON
Expand Down

0 comments on commit 7fa5106

Please sign in to comment.