Skip to content

Commit f3778b0

Browse files
committed
fix: update even names and children generator
1 parent d94aacd commit f3778b0

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

src/components/sidebar/CSidebarNav.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@ const CSidebarNav = defineComponent({
2424
class: 'sidebar-nav',
2525
},
2626
slots.default &&
27-
slots.default().map((vnode, index) =>
28-
h(vnode, {
29-
onVisibleChange: (visible: boolean) => handleVisibleChange(visible, index),
30-
visible: isVisible(index),
31-
}),
32-
),
27+
slots.default().map((vnode, index) => {
28+
// @ts-expect-error name is defined in component
29+
if (vnode.type.name === 'CNavGroup') {
30+
return h(vnode, {
31+
onVisibleChange: (visible: boolean) => handleVisibleChange(visible, index),
32+
visible: isVisible(index),
33+
})
34+
}
35+
return vnode
36+
}),
3337
)
3438
},
3539
})

src/components/widgets/CWidgetStatsD.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { Color } from '../props'
44
import { CCard, CCardBody, CCardHeader } from './../card/'
55
import { CCol } from './../grid/'
66

7+
type Value = {
8+
title?: string
9+
value?: number | string
10+
}
11+
712
const CWidgetStatsD = defineComponent({
813
name: 'CWidgetStatsD',
914
props: {
@@ -17,12 +22,12 @@ const CWidgetStatsD = defineComponent({
1722
* Values and titles for your component.
1823
*/
1924
values: {
20-
type: Array as PropType<number[] | string[]>,
25+
type: Array as PropType<Value[]>,
2126
default: () => [],
2227
require: false,
2328
},
2429
},
25-
/**
30+
/**
2631
* Location for icon component, ex. `<CDropdown>`.
2732
*
2833
* @slot icon
@@ -59,18 +64,18 @@ const CWidgetStatsD = defineComponent({
5964
{
6065
default: () =>
6166
props.values &&
62-
props.values.map((value: number | string, index: number) => [
67+
props.values.map((value: Value, index: number) => [
6368
index % 2 !== 0 && h('div', { class: 'vr' }),
6469
h(
6570
CCol,
6671
{},
6772
{
6873
default: () => [
69-
h(CCol, { class: 'fs-5 fw-semibold' }, () => value[0]),
74+
h(CCol, { class: 'fs-5 fw-semibold' }, () => value.value),
7075
h(
7176
CCol,
7277
{ class: 'text-uppercase text-medium-emphasis small' },
73-
() => value[1],
78+
() => value.title,
7479
),
7580
],
7681
},

0 commit comments

Comments
 (0)