File tree Expand file tree Collapse file tree 6 files changed +36
-16
lines changed Expand file tree Collapse file tree 6 files changed +36
-16
lines changed Original file line number Diff line number Diff line change @@ -446,8 +446,7 @@ export declare class CPagination extends Vue {
446
446
responsive ?: boolean
447
447
}
448
448
449
- export declare class CProgress extends Vue {
450
- height ?: string
449
+ export declare class CProgressBar extends Vue {
451
450
color ?: string
452
451
striped ?: boolean
453
452
animated ?: boolean
@@ -458,7 +457,11 @@ export declare class CProgress extends Vue {
458
457
value ?: number
459
458
}
460
459
461
- export declare class CProgressBar extends CProgress { }
460
+ export declare class CProgress extends CProgressBar {
461
+ height ?: string
462
+ size ?: string
463
+ }
464
+
462
465
463
466
type ContentFlat = [ NodeFlat ]
464
467
declare interface NodeFlat {
Original file line number Diff line number Diff line change 1
1
<template >
2
- <div class =" progress" :style =" { height }" >
2
+ <div
3
+ :class ="
8000
span>['progress', size && `progress-${size}`]"
4
+ :style =" { height }"
5
+ >
3
6
<slot >
4
7
<CProgressBar :value =" value" />
5
8
</slot >
8
11
9
12
<script >
10
13
import CProgressBar from ' ./CProgressBar'
11
- import props from ' ./progress-props'
14
+ import shared from ' ./shared-props'
15
+
16
+ const props = {
17
+ ... shared,
18
+ height: String ,
19
+ size: {
20
+ type: String ,
21
+ validator : val => [' ' , ' xs' , ' sm' ].includes (val)
22
+ },
23
+ }
12
24
13
25
export default {
14
26
name: ' CProgress' ,
15
27
components: { CProgressBar },
16
28
props,
29
+ mounted () {
30
+ /* istanbul ignore next */
31
+ if (this .height && process && process .env && process .env .NODE_ENV === ' development' ) {
32
+ console .error (" CProgress component: 'height' prop is deprecated and will be removed in the next version. Use 'size' prop instead or pass custom height in 'style' attribute." )
33
+ }
34
+ },
17
35
provide () {
18
36
const progress = {}
19
37
Object .defineProperty (progress, ' props' , {
Original file line number Diff line number Diff line change 12
12
</template >
13
13
14
14
<script >
15
- import props from ' ./progress-props'
15
+ import props from ' ./shared-props'
16
+
16
17
export default {
17
18
name: ' CProgressBar' ,
18
19
props,
19
20
inject: {
20
21
progress: {
21
- default: undefined
22
+ default: { props : {} }
22
23
}
23
24
},
24
25
computed: {
25
26
directlyDeclaredProps () {
26
27
return Object .keys (this .$options .propsData )
27
28
},
28
- injectedProps () {
29
- return this .progress && this .progress .props ? this .progress .props : {}
30
- },
31
29
props () {
32
30
return Object .keys (props).reduce ((computedProps , key ) => {
33
31
const propIsDirectlyDeclared = this .directlyDeclaredProps .includes (key)
34
- const parentPropExists = this .injectedProps [key] !== undefined
35
- const propIsInherited = parentPropExists && ! propIsDirectlyDeclared
36
- computedProps[key] = propIsInherited ? this .injectedP
6D40
rops [key] : this [key]
32
+ const parentPropExists = this .progress . props [key] !== undefined
33
+ const isInherited = parentPropExists && ! propIsDirectlyDeclared
34
+ computedProps[key] = isInherited ? this .progress . props [key] : this [key]
37
35
return computedProps
38
36
}, {})
39
37
},
Original file line number Diff line number Diff line change 1
1
export default {
2
- height : String ,
3
- // These props can be inherited via the child CProgressBar(s)
4
2
color : String ,
5
3
striped : Boolean ,
6
4
animated : Boolean ,
Original file line number Diff line number Diff line change @@ -6,7 +6,9 @@ const defaultWrapper = mount(Component)
6
6
const customWrapper = mount ( Component , {
7
7
propsData : {
8
8
color : 'black' ,
9
- value : 20
9
+ value : 20 ,
10
+ size : 'sm' ,
11
+ height : '2rem'
10
12
} ,
11
13
attrs : {
12
14
class : 'test'
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ exports[`CProgress renders correctly 1`] = `
20
20
exports [` CProgress renders correctly 2` ] = `
21
21
<div
22
22
class = " test"
23
+ style = " height: 2rem;"
23
24
>
24
25
<div
25
26
aria-valuemax = " 100"
You can’t perform that action at this time.
0 commit comments