Skip to content

Commit 1753e17

Browse files
committed
Fix: Smaller changes in components
1 parent 0f1b988 commit 1753e17

20 files changed

+232
-242
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"element-resize-detector": "^1.2.0",
6363
"popper.js": "^1.14.6",
6464
"tooltip.js": "^1.3.1",
65-
"vue": "^2.5.17",
65+
"vue": "^2.6.6",
6666
"vue-clickaway": "^2.2.2",
6767
"vue-functional-data-merge": "^2.0.7",
6868
"vue-perfect-scrollbar": "^0.1.0"
@@ -90,7 +90,7 @@
9090
"sass-loader": "^7.1.0",
9191
"vue-jest": "^3.0.1",
9292
"vue-router": "^3.0.2",
93-
"vue-template-compiler": "^2.5.17"
93+
"vue-template-compiler": "^2.6.6"
9494
},
9595
"eslintConfig": {
9696
"root": true,

src/components/Card/CCardGroup.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
import { mergeData } from 'vue-functional-data-merge'
2-
3-
export const props = {
4-
tag: String,
5-
deck: Boolean,
6-
columns: Boolean,
7-
}
82
export default {
93
functional: true,
104
name: 'CCardGroup',
11-
props,
5+
props: {
6+
tag: String,
7+
deck: Boolean,
8+
columns: Boolean,
9+
},
1210
render (h, { props, data, children }) {
13-
let staticClass = 'card-group'
14-
if (props.columns)
15-
staticClass = 'card-columns'
16-
if (props.deck)
17-
staticClass = 'card-deck'
18-
return h(props.tag || 'div' , mergeData(data, { staticClass }), children)
11+
return h(
12+
props.tag || 'div',
13+
mergeData(data, {
14+
staticClass: `card-${props.columns ? 'columns' : props.deck ? 'deck' : 'group'}`
15+
}),
16+
children
17+
)
1918
}
2019
}

src/components/Collapse/CCollapse.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const props = {
1+
const props = {
22
tag: {
33
type: String,
44
default: 'div'
@@ -21,27 +21,30 @@ export default {
2121
data () {
2222
return {
2323
collapsing: false,
24-
heightWatcher: null
24+
heightWatcher: null,
2525
}
2626
},
2727
watch: {
2828
show (val) {
29-
if(this.collapsing){
29+
this.collapse(val)
30+
},
31+
},
32+
mounted () {
33+
this.$el.style.display = this.show ? '' : 'none'
34+
},
35+
methods: {
36+
collapse (val) {
37+
if (this.collapsing) {
3038
this.turn()
3139
const height = Number(this.collapsing.slice(0,-2))
3240
const current = this.$el.offsetHeight
3341
const time = val ? (height - current) / height : current / height
3442
this.setFinishTimer(this.duration * time)
35-
}else{
43+
} else {
3644
val ? this.toggle(true) : this.toggle(false)
3745
this.setFinishTimer(this.duration)
3846
}
3947
},
40-
},
41-
mounted () {
42-
this.$el.style.display = this.show ? '' : 'none'
43-
},
44-
methods: {
4548
turn () {
4649
if(this.show)
4750
this.$el.style.height = this.collapsing

src/components/Form/CFormFile.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<input v-bind="$attrs"
1515
:id="safeId"
1616
:class="inputClasses"
17+
:multiple="multiple"
1718
type="file"
1819
@change="onChange($event)"
1920
/>

src/components/Form/CFormGroup.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<template functional>
2-
<div :class="[data.class, data.staticClass]" :style="[data.style, data.staticStyle]">
2+
<div :class="[data.class, data.staticClass]"
3+
:style="[data.style, data.staticStyle]"
4+
role="group"
5+
>
36
<template v-if="props.wrapperClasses">
47
<slot name="label"></slot>
58
<div :class="props.wrapperClasses">
@@ -58,7 +61,7 @@ import { formGroupProps as props } from './formProps'
5861
export default {
5962
name: 'CFormGroup',
6063
inheritAttrs: false,
61-
props,
64+
props,
6265
// {
6366
// wrapperClasses: [String, Array, Object],
6467
// append: String,

src/components/Form/CFormInput.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<template >
1+
<template>
22
<CFormGroup v-bind="{append, prepend, validFeedback,
33
invalidFeedback, tooltipFeedback, description,
44
wrapperClasses, class: computedClasses}"
55
>
66
<template slot="label">
77
<slot name="label">
8-
<label v-if="label" :for="safeId" :class="labelClasses">{{label}}</label>
8+
<label v-if="label" :for="safeId" :class="labelClasses" v-html="label"></label>
99
</slot>
1010
</template>
1111
<input slot="input"
@@ -30,10 +30,12 @@
3030
</template>
3131

3232
<script>
33+
import CFormGroup from './CFormGroup'
3334
import { formInputProps as props } from './formProps'
35+
3436
import * as allFormMixins from './formMixins'
3537
const mixins = Object.values(allFormMixins)
36-
import CFormGroup from './CFormGroup'
38+
3739
export default {
3840
name: 'CFormInput',
3941
inheritAttrs: false,

src/components/Form/CFormSelect.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export default {
8989
// },
9090
data () {
9191
return {
92-
state: this.value
92+
state: typeof this.$options.propsData.value !== 'undefined' ? this.value : ''
9393
}
9494
},
9595
computed: {
@@ -113,7 +113,7 @@ export default {
113113
// }]
114114
// },
115115
customSizeClass () {
116-
return this.haveCustomSize ?
116+
return this.haveCustomSize && !this.haveWrapper ?
117117
`${this.custom ? 'custom-select' : 'form-control'}-${this.size}` :
118118
null
119119
},

src/components/Form/CFormTextarea.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
</template>
2929

3030
<script>
31+
import CFormGroup from './CFormGroup'
32+
import { formTextareaProps as props} from './formProps'
33+
3134
import * as allFormMixins from './formMixins'
3235
const mixins = Object.values(allFormMixins)
33-
import { formTextareaProps as props} from './formProps'
34-
import CFormGroup from './CFormGroup'
36+
3537
export default {
3638
name: 'CFormTextarea',
3739
inheritAttrs: false,

src/components/Form/formMixins.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ export const wrapperComputedProps = {
1616
wrapperClasses () {
1717
if(this.haveWrapper)
1818
return [ this.addWrapperClasses, {
19-
[this.horizontal.input || 'col-10'] : this.isHorizontal,
20-
'input-group' : this.haveInputGroup
19+
[this.horizontal.input || 'col-sm-9'] : this.isHorizontal,
20+
'input-group' : this.haveInputGroup,
21+
[`input-group-${this.size}`]: this.haveCustomSize
2122
}]
2223
}
2324
}
@@ -50,25 +51,27 @@ export const watchValue = {
5051
export const classesComputedProps = {
5152
computed: {
5253
haveCustomSize () {
53-
return ['','sm','lg'].includes(this.size) && Boolean(this.size)
54+
return ['sm','lg'].includes(this.size)
5455
},
5556
computedClasses () {
5657
return [
57-
this.isHorizontal ? 'form-row': 'form-group',
58+
'form-group',
5859
{
59-
'was-validated': this.wasValidated
60+
'was-validated': this.wasValidated,
61+
'form-row': this.isHorizontal
6062
}
6163
]
6264
},
6365
labelClasses () {
6466
return [ this.addLabelClasses, {
6567
'col-form-label': this.isHorizontal,
66-
[this.horizontal.label || 'col-2']: this.isHorizontal,
68+
[this.horizontal.label || 'col-sm-3']: this.isHorizontal,
6769
[`col-form-label-${this.size}`]: this.haveCustomSize,
6870
}]
6971
},
7072
customSizeClass () {
71-
return this.haveCustomSize ? `form-control-${this.size}` : null
73+
return this.haveCustomSize && !this.haveWrapper ?
74+
`form-control-${this.size}` : null
7275
},
7376
inputClasses () {
7477
return [

src/components/Form/formProps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const props = Object.assign({}, universalProps, {
3737
const textInputsProps = {
3838
readonly: Boolean,
3939
plaintext: Boolean,
40-
value: [String, Number, Boolean],
40+
value: String,
4141
lazy: {
4242
type: [Boolean, Number],
4343
default: 400

0 commit comments

Comments
 (0)