@energysage/es-ds-components 3.0.0-alpha.11 → 3.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -17,19 +17,27 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
17
17
|
// eslint-disable-next-line vue/require-prop-types
|
|
18
18
|
const model = defineModel();
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
// get the list of elements provided as children to the default slot
|
|
21
|
+
const initialChildren = useSlots().default?.() || [];
|
|
22
|
+
const children: any[] = [];
|
|
23
|
+
initialChildren.forEach((child) => {
|
|
24
|
+
// unless this has a v-for element and we instead need to access its children
|
|
25
|
+
if (typeof child.type === 'symbol' && Array.isArray(child.children)) {
|
|
26
|
+
children.push(...child.children);
|
|
27
|
+
} else {
|
|
28
|
+
children.push(child);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
21
31
|
|
|
22
32
|
const activeIndex = ref();
|
|
23
33
|
|
|
24
34
|
watch(model, (newVal) => {
|
|
25
35
|
if (newVal) {
|
|
26
|
-
// @ts-expect-error not sure
|
|
27
36
|
activeIndex.value = children.findIndex((child) => child.props.id === newVal);
|
|
28
37
|
}
|
|
29
38
|
});
|
|
30
39
|
|
|
31
40
|
const accordionTabs = children.map((child, index) => {
|
|
32
|
-
// @ts-expect-error not sure
|
|
33
41
|
if (child.props.id === props.initialExpandedId || child.props.id === model.value) {
|
|
34
42
|
activeIndex.value = index;
|
|
35
43
|
}
|
|
@@ -38,7 +46,6 @@ const accordionTabs = children.map((child, index) => {
|
|
|
38
46
|
|
|
39
47
|
const updateActiveIndex = (index: any) => {
|
|
40
48
|
if (model.value) {
|
|
41
|
-
// @ts-expect-error not sure
|
|
42
49
|
model.value = children[index]?.props.id || '';
|
|
43
50
|
}
|
|
44
51
|
};
|
|
@@ -99,7 +106,6 @@ const updateActiveIndex = (index: any) => {
|
|
|
99
106
|
role="heading"
|
|
100
107
|
aria-level="3"
|
|
101
108
|
:class="{ 'h3 mb-0': variant === 'minimal' }">
|
|
102
|
-
<!-- @vue-expect-error -->
|
|
103
109
|
<component
|
|
104
110
|
:is="item"
|
|
105
111
|
v-for="item in tab.title()"
|
|
@@ -107,7 +113,6 @@ const updateActiveIndex = (index: any) => {
|
|
|
107
113
|
</span>
|
|
108
114
|
<icon-chevron-down class="es-accordion-icon flex-shrink-0 ml-200" />
|
|
109
115
|
</template>
|
|
110
|
-
<!-- @vue-expect-error -->
|
|
111
116
|
<component
|
|
112
117
|
:is="item"
|
|
113
118
|
v-for="item in tab.default()"
|
package/components/es-tabs.vue
CHANGED
|
@@ -6,7 +6,16 @@ import TabView from 'primevue/tabview';
|
|
|
6
6
|
const model = defineModel<number>();
|
|
7
7
|
|
|
8
8
|
// get the list of elements provided as children to the default slot
|
|
9
|
-
const
|
|
9
|
+
const initialChildren = useSlots().default?.() || [];
|
|
10
|
+
const panels: any[] = [];
|
|
11
|
+
initialChildren.forEach((child) => {
|
|
12
|
+
// unless this has a v-for element and we instead need to access its children
|
|
13
|
+
if (typeof child.type === 'symbol' && Array.isArray(child.children)) {
|
|
14
|
+
panels.push(...child.children);
|
|
15
|
+
} else {
|
|
16
|
+
panels.push(child);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
10
19
|
|
|
11
20
|
// keep track of the active tab index
|
|
12
21
|
// - from above, if v-model is used
|
|
@@ -36,7 +45,6 @@ const updateActiveIndex = (index: number) => {
|
|
|
36
45
|
panelContainer: 'tab-content',
|
|
37
46
|
}"
|
|
38
47
|
@update:active-index="updateActiveIndex">
|
|
39
|
-
<!-- @vue-expect-error -->
|
|
40
48
|
<tab-panel
|
|
41
49
|
v-for="(panel, index) in panels"
|
|
42
50
|
:key="index"
|
|
@@ -60,7 +68,6 @@ const updateActiveIndex = (index: number) => {
|
|
|
60
68
|
],
|
|
61
69
|
}),
|
|
62
70
|
}">
|
|
63
|
-
<!-- @vue-expect-error -->
|
|
64
71
|
<component
|
|
65
72
|
:is="item"
|
|
66
73
|
v-for="(item, idx) in panel.children.default()"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@energysage/es-ds-components",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "An EnergySage Vue component library",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"author": "EnergySage",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@energysage/es-ds-styles": "^3.0.0-alpha.
|
|
20
|
+
"@energysage/es-ds-styles": "^3.0.0-alpha.10",
|
|
21
21
|
"@nuxtjs/google-fonts": "^3.2.0",
|
|
22
22
|
"@vuelidate/core": "^2.0.3",
|
|
23
23
|
"@vuelidate/validators": "^2.0.4",
|