@kiva/kv-components 3.102.2 → 3.102.4
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.
- package/CHANGELOG.md +22 -0
- package/package.json +2 -2
- package/vue/KvPieChart.vue +16 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.102.4](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.102.3...@kiva/kv-components@3.102.4) (2024-10-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* pie chart not animating in vue 3 ([c15efec](https://github.com/kiva/kv-ui-elements/commit/c15efec2cebf39fcafaa0eb533bd6ef8ffab2d6d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [3.102.3](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.102.2...@kiva/kv-components@3.102.3) (2024-09-30)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* width classes added to pie chart ([#463](https://github.com/kiva/kv-ui-elements/issues/463)) ([77715e2](https://github.com/kiva/kv-ui-elements/commit/77715e2d27a19bbb9c3cdd5239a037ae04ee5715))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [3.102.2](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.102.1...@kiva/kv-components@3.102.2) (2024-09-26)
|
|
7
29
|
|
|
8
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "3.102.
|
|
3
|
+
"version": "3.102.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"optional": true
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "9d819f1b11475de5c5f728409069c241f399cc0f"
|
|
87
87
|
}
|
package/vue/KvPieChart.vue
CHANGED
|
@@ -4,18 +4,17 @@
|
|
|
4
4
|
@mouseleave="activeSlice = null"
|
|
5
5
|
>
|
|
6
6
|
<!-- pie chart -->
|
|
7
|
-
<div class="tw-relative
|
|
7
|
+
<div class="tw-relative">
|
|
8
8
|
<div
|
|
9
9
|
v-if="loading"
|
|
10
|
-
class="pie-placeholder tw-
|
|
10
|
+
class="pie-placeholder tw-mt-2.5"
|
|
11
11
|
>
|
|
12
|
-
<div class="tw-overflow-hidden tw-rounded-full
|
|
12
|
+
<div class="tw-overflow-hidden tw-rounded-full">
|
|
13
13
|
<kv-loading-placeholder />
|
|
14
14
|
</div>
|
|
15
15
|
</div>
|
|
16
16
|
<svg
|
|
17
17
|
v-else
|
|
18
|
-
class="tw-h-full"
|
|
19
18
|
viewBox="0 0 32 32"
|
|
20
19
|
xmlns="http://www.w3.org/2000/svg"
|
|
21
20
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
@@ -24,7 +23,7 @@
|
|
|
24
23
|
v-for="(slice, index) in slices"
|
|
25
24
|
:key="index"
|
|
26
25
|
class="tw-origin-center tw-transition-transform"
|
|
27
|
-
:style="
|
|
26
|
+
:style="isSliceActive(slice) ? { transform: 'scale(1.1)' } : {}"
|
|
28
27
|
:d="slice.path"
|
|
29
28
|
:stroke="slice.color"
|
|
30
29
|
:stroke-width="lineWidth"
|
|
@@ -175,7 +174,7 @@ export default {
|
|
|
175
174
|
const end = start + value.percent;
|
|
176
175
|
const [startX, startY] = circumPointFromAngle(cX, cY, r, start * Math.PI * 2);
|
|
177
176
|
let path = `M ${startX},${startY} `;
|
|
178
|
-
if (value.percent
|
|
177
|
+
if (value.percent > 0.99) {
|
|
179
178
|
// Draw a full circle in two arcs
|
|
180
179
|
const [midX, midY] = circumPointFromAngle(cX, cY, r, (start + end) * Math.PI);
|
|
181
180
|
path += `A ${r},${r} 0 0,1 ${midX},${midY} `;
|
|
@@ -211,6 +210,10 @@ export default {
|
|
|
211
210
|
}
|
|
212
211
|
};
|
|
213
212
|
|
|
213
|
+
const isSliceActive = (slice) => {
|
|
214
|
+
return activeSlice.value === slice;
|
|
215
|
+
};
|
|
216
|
+
|
|
214
217
|
const setActiveSlice = (slice) => {
|
|
215
218
|
activeSlice.value = slice;
|
|
216
219
|
emit('click', slice.label);
|
|
@@ -229,6 +232,7 @@ export default {
|
|
|
229
232
|
pageCount,
|
|
230
233
|
prevPage,
|
|
231
234
|
nextPage,
|
|
235
|
+
isSliceActive,
|
|
232
236
|
setActiveSlice,
|
|
233
237
|
};
|
|
234
238
|
},
|
|
@@ -236,14 +240,13 @@ export default {
|
|
|
236
240
|
</script>
|
|
237
241
|
|
|
238
242
|
<style lang="postcss" scoped>
|
|
239
|
-
.pie-chart {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
height: 20rem;
|
|
243
|
-
}
|
|
243
|
+
.pie-chart svg {
|
|
244
|
+
width: 20rem;
|
|
245
|
+
height: 20rem;
|
|
244
246
|
}
|
|
245
247
|
|
|
246
|
-
.pie-placeholder {
|
|
247
|
-
width:
|
|
248
|
+
.pie-placeholder, .pie-placeholder div {
|
|
249
|
+
width: 17.5rem;
|
|
250
|
+
height: 17.5rem;
|
|
248
251
|
}
|
|
249
252
|
</style>
|