Skip to content

Commit f4710c0

Browse files
committed
refactor: minor code refactors, update snapshots
1 parent 6da7e77 commit f4710c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+738
-643
lines changed

dist/coreui-vue.common.js

Lines changed: 214 additions & 192 deletions
Large diffs are not rendered by default.

dist/coreui-vue.common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/coreui-vue.esm.js

Lines changed: 87 additions & 91 deletions
Large diffs are not rendered by default.

dist/coreui-vue.umd.js

Lines changed: 214 additions & 192 deletions
Large diffs are not rendered by default.

dist/coreui-vue.umd.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/coreui-vue.umd.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/coreui-vue.umd.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/alert/CAlert.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,11 @@ export default {
8686
}
8787
</script>
8888

89-
<style>
89+
<style scoped>
9090
.fade-enter-active, .fade-leave-active {
9191
transition: opacity .3s;
9292
}
9393
.fade-enter, .fade-leave-to {
9494
opacity: 0;
9595
}
96-
9796
</style>

src/components/badge/CBadge.vue

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@
22
import { mergeData } from 'vue-functional-data-merge'
33
import CLink, { props as linkProps } from '../link/CLink'
44
5-
const props = Object.assign({}, linkProps, {
6-
tag: {
7-
type: String,
8-
default: 'span'
9-
},
10-
color: String,
11-
shape: {
12-
type: String,
13-
validator: shape => ['', 'pill'].includes(shape)
5+
const props = Object.assign(
6+
{},
7+
linkProps,
8+
{
9+
tag: {
10+
type: String,
11+
default: 'span'
12+
},
13+
color: String,
14+
shape: {
15+
type: String,
16+
validator: shape => ['', 'pill'].includes(shape)
17+
}
1418
}
15-
})
19+
)
1620
1721
export default {
1822
functional: true,

src/components/breadcrumb/CBreadcrumb.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
</li>
1313
<li
1414
v-if="lastItem"
15-
:class="['active', lastItem.addClasses, sharedClasses, addLastItemClasses]"
15+
:class="lastItemClasses"
1616
role="presentation"
1717
>
18-
<!-- span added to enable text styling through classes -->
19-
<span v-text="lastItem.text"></span>
18+
<!-- span added to enable text styling through classes -->
19+
<span v-text="lastItem.text"></span>
2020
</li>
2121
<slot></slot>
2222
</ol>
@@ -45,6 +45,14 @@ export default {
4545
},
4646
sharedClasses () {
4747
return [this.addClasses, 'breadcrumb-item']
48+
},
49+
lastItemClasses () {
50+
return [
51+
'active',
52+
this.lastItem.addClasses,
53+
this.sharedClasses,
54+
this.addLastItemClasses
55+
]
4856
}
4957
}
5058
}

src/components/button/CButton.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function computeClasses (props) {
4141
const outlineSuffix = props.variant === 'outline' ? 'outline-' : ''
4242
return {
4343
[`btn-${outlineSuffix}${props.color}`]: props.color,
44-
[`btn-${props.size}`]: Boolean(props.size),
44+
[`btn-${props.size}`]: props.size,
4545
[`btn-ghost-${props.color}`]: props.variant === 'ghost',
4646
'btn-block': props.block,
4747
'btn-pill': props.shape === 'pill',
@@ -80,7 +80,7 @@ export default {
8080
const on = {
8181
click () {
8282
if (toggle && listeners && listeners['update:pressed']) {
83-
// Send .sync updates to any "pressed" prop (if .sync listeners)
83+
// Send .sync updates to "pressed" prop (if .sync listener is set)
8484
listeners['update:pressed'](!props.pressed)
8585
}
8686
}

src/components/button/CButtonGroup.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default {
1616
mergeData(data, {
1717
class: [
1818
!props.vertical ? 'btn-group' : 'btn-group-vertical',
19-
{ [`btn-group-${props.size}`] : Boolean(props.size) }
19+
{ [`btn-group-${props.size}`] : props.size }
2020
],
2121
attrs: {
2222
role: 'group'

src/components/card/CCardBody.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ export default {
1313
staticClass: 'card-body',
1414
class: [
1515
{
16-
[`bg-${props.color}`]: Boolean(props.color),
17-
[`border-${props.borderColor}`]: Boolean(props.borderColor),
18-
[`text-${props.textColor}`]: Boolean(props.textColor),
19-
[`text-${props.align}`]: Boolean(props.align)
16+
[`bg-${props.color}`]: props.color,
17+
[`border-${props.borderColor}`]: props.borderColor,
18+
[`text-${props.textColor}`]: props.textColor,
19+
[`text-${props.align}`]: props.align
2020
}
2121
]
2222
}),

src/components/card/CCardFooter.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ export default {
1313
staticClass: 'card-footer',
1414
class: [
1515
{
16-
[`text-${props.align}`]: Boolean(props.align),
17-
[`bg-${props.color}`]: Boolean(props.color),
18-
[`border-${props.borderColor}`]: Boolean(props.borderColor),
19-
[`text-${props.textColor}`]: Boolean(props.textColor)
16+
[`text-${props.align}`]: props.align,
17+
[`bg-${props.color}`]: props.color,
18+
[`border-${props.borderColor}`]: props.borderColor,
19+
[`text-${props.textColor}`]: props.textColor
2020
}
2121
]
2222
}),

src/components/card/CCardGroup.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ export default {
44
functional: true,
55
name: 'CCardGroup',
66
props: {
7-
tag: String,
7+
tag: {
8+
type: String,
9+
default: 'div'
10+
},
811
deck: Boolean,
912
columns: Boolean
1013
},
1114
render (h, { props, data, children }) {
15+
const type = props.columns ? 'columns' : props.deck ? 'deck' : 'group'
1216
return h(
13-
props.tag || 'div',
17+
props.tag,
1418
mergeData(data, {
15-
staticClass: `card-${props.columns ? 'columns' : props.deck ? 'deck' : 'group'}`
19+
staticClass: `card-${type}`
1620
}),
1721
children
1822
)

src/components/card/CCardHeader.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ export default {
1313
staticClass: 'card-header',
1414
class: [
1515
{
16-
[`text-${props.align}`]: Boolean(props.align),
17-
[`bg-${props.color}`]: Boolean(props.color),
18-
[`border-${props.borderColor}`]: Boolean(props.borderColor),
19-
[`text-${props.textColor}`]: Boolean(props.textColor)
16+
[`text-${props.align}`]: props.align,
17+
[`bg-${props.color}`]: props.color,
18+
[`border-${props.borderColor}`]: props.borderColor,
19+
[`text-${props.textColor}`]: props.textColor
2020
}
2121
]
2222
}),

src/components/card/CCardImgOverlay.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ export default {
55
functional: true,
66
name: 'CCardImgOverlay',
77
props: {
8-
tag: String
8+
tag: {
9+
type: String,
10+
default: 'div'
11+
}
912
},
1013
render (h, { props, data, children }) {
1114
return h(
12-
props.tag || 'div',
15+
props.tag,
1316
mergeData(data, {
1417
staticClass: 'card-img-overlay'
1518
}),

src/components/card/CCardSubtitle.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ export default {
55
functional: true,
66
name: 'CCardSubtitle',
77
props: {
8-
tag: String
8+
tag: {
9+
type: String,
10+
default: 'h6'
11+
}
912
},
1013
render (h, { props, data, children }) {
1114
return h(
12-
props.tag || 'h6',
15+
props.tag,
1316
mergeData(data, {
1417
staticClass: 'card-subtitle'
1518
}),

src/components/card/CCardText.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ export default {
55
functional: true,
66
name: 'CCardText',
77
props: {
8-
tag: String
8+
tag: {
9+
type: String,
10+
default: 'p'
11+
}
912
},
1013
render (h, { props, data, children }) {
1114
return h(
12-
props.tag || 'p',
15+
props.tag,
1316
mergeData(data, {
1417
staticClass: 'card-text'
1518
}),

src/components/card/CCardTitle.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ export default {
55
functional: true,
66
name: 'CCardTitle',
77
props: {
8-
tag: String
8+
tag: {
9+
type: String,
10+
default: 'h4'
11+
}
912
},
1013
render (h, { props, data, children }) {
1114
return h(
12-
props.tag || 'h4',
15+
props.tag,
1316
mergeData(data, {
1417
staticClass: 'card-title'
1518
}),

src/components/carousel/CCarousel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default {
110110
}
111111
</script>
112112

113-
<style>
113+
<style scoped>
114114
.carousel-inner, .carousel-item {
115115
height: inherit;
116116
}

src/components/collapse/CCollapse.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default {
5252
this.turn()
5353
const height = Number(this.collapsing.slice(0,-2))
5454
const current = this.$el.offsetHeight
55-
const time = val ? (height - current) / height : current / height
55+
const time = (val ? height - current : current) / height
5656
this.setFinishTimer(this.duration * time)
5757
}
5858
},

src/components/dropdown/CDropdown.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export default {
198198
return {
199199
'type': this.inNav ? null : 'button',
200200
'aria-expanded': this.visible ? 'true' : 'false',
201-
'aria-haspopup': 'true',
201+
'aria-haspopup': 'true'
202202
}
203203
},
204204

src/components/form/CFormGroup.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
class="input-group-prepend"
99
>
1010
<slot name="prepend">
11-
<span class="input-group-text"><slot name="prepend-content">{{prepend}}</slot></span>
11+
<span class="input-group-text">
12+
<slot name="prepend-content">{{prepend}}</slot>
13+
</span>
1214
</slot>
1315
</div>
1416
<slot name="input"></slot>
@@ -53,7 +55,9 @@
5355
class="input-group-prepend"
5456
>
5557
<slot name="prepend">
56-
<span class="input-group-text"><slot name="prepend-content">{{prepend}}</slot></span>
58+
<span class="input-group-text">
59+
<slot name="prepend-content">{{prepend}}</slot>
60+
</span>
5761
</slot>
5862
</div>
5963
<slot name="input"></slot>

src/components/form/CInput.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
/>
2424
</template>
2525

26-
<template v-for="slot in $options.slots" #[slot]>
26+
<template
27+
v-for="slot in $options.slots"
28+
#[slot]
29+
>
2730
<slot :name="slot"></slot>
2831
</template>
2932
</CFormGroup>
@@ -79,7 +82,7 @@ export default {
7982
8083
// readonly: Boolean,
8184
// plaintext: Boolean,
82-
// value: String,
85+
// value: [String, Number],
8386
// lazy: {
8487
// type: [Boolean, Number],
8588
// default: 400

src/components/form/CInputCheckbox.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default {
5858
// addInputClasses: [String, Array, Object],
5959
// addLabelClasses: [String, Array, Object],
6060
61-
// checked: [Boolean, String, Number],
61+
// checked: Boolean,
6262
// custom: Boolean,
6363
// inline: Boolean
6464
// },

src/components/form/CInputFile.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232

3333

3434
<template
35-
v-for="slot in ['label-after-input','valid-feedback',
36-
'invalid-feedback','description']"
35+
v-for="slot in $options.slots"
3736
#[slot]
3837
>
3938
<slot :name="slot"></slot>
@@ -43,15 +42,20 @@
4342

4443
<script>
4544
import * as allFormMixins from './form-mixins'
46-
const mixins = Object.values(allFormMixins).filter((i, key) => key !== 'watchValue')
4745
import { inputFileProps as props } from './form-props'
4846
import CFormGroup from './CFormGroup'
47+
const mixins = Object.values(allFormMixins).filter((i, key) => {
48+
return key !== 'watchValue'
49+
})
4950
5051
export default {
5152
name: 'CInputFile',
5253
inheritAttrs: false,
5354
components: { CFormGroup },
5455
mixins,
56+
slots: [
57+
'label-after-input','valid-feedback','invalid-feedback','description'
58+
],
5559
props,
5660
// {
5761
// validFeedback: String,

src/components/form/CSelect.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@
5454
</select>
5555
</template>
5656

57-
<template v-for="slot in $options.slots" #[slot]>
57+
<template
58+
v-for="slot in $options.slots"
59+
#[slot]
60+
>
5861
<slot :name="slot"></slot>
5962
</template>
6063
</CFormGroup>

src/components/form/CTextarea.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
/>
2323
</template>
2424

25-
<template v-for="slot in $options.slots" #[slot]>
25+
<template
26+
v-for="slot in $options.slots"
27+
#[slot]
28+
>
2629
<slot :name="slot"></slot>
2730
</template>
2831
</CFormGroup>
@@ -78,7 +81,7 @@ export default {
7881
7982
// readonly: Boolean,
8083
// plaintext: Boolean,
81-
// value: String,
84+
// value: [String, Number],
8285
// lazy: {
8386
// type: [Boolean, Number],
8487
// default: 400

0 commit comments

Comments
 (0)