Skip to content

Commit 5dd3e61

Browse files
committed
VueUiSkeleton add rings & wheel types
1 parent 63b65b7 commit 5dd3e61

File tree

7 files changed

+147
-22
lines changed

7 files changed

+147
-22
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-data-ui",
33
"private": false,
4-
"version": "1.9.29",
4+
"version": "1.9.30",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue components library",
77
"keywords": [

src/App.vue

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3500,6 +3500,28 @@ function copyConfig(c) {
35003500
35013501
const updateStep = ref(0);
35023502
3503+
const skeletonOptions = ref([
3504+
'line',
3505+
'sparkline',
3506+
'bar',
3507+
'donut',
3508+
'onion',
3509+
'gauge',
3510+
'quadrant',
3511+
'radar',
3512+
'waffle',
3513+
'table',
3514+
'rating',
3515+
'verticalBar',
3516+
'heatmap',
3517+
'candlesticks',
3518+
'pyramid',
3519+
'rings',
3520+
'wheel'
3521+
]);
3522+
3523+
const skeletonChoice = ref('wheel')
3524+
35033525
</script>
35043526

35053527
<template>
@@ -3513,7 +3535,29 @@ const updateStep = ref(0);
35133535
<h4 style="color: #5f8bee">Manual testing arena</h4>
35143536
</div>
35153537

3516-
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_wheel)" open>
3538+
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_skeleton)" open>
3539+
<template #general>
3540+
<select v-model="skeletonChoice">
3541+
<option v-for="(opt) in skeletonOptions">{{ opt }}</option>
3542+
</select>
3543+
</template>
3544+
<template #title>VueUiSkeleton</template>
3545+
<template #dev>
3546+
<SkeletonTest
3547+
:config="{ type: skeletonChoice, style: { rating: { useSmiley: true, filled: true } } }"
3548+
/>
3549+
</template>
3550+
<template #prod>
3551+
<VueUiSkeleton
3552+
:config="{ type: skeletonChoice, style: { rating: { useSmiley: true, filled: true } } }"
3553+
/>
3554+
</template>
3555+
<template #config>
3556+
{{ PROD_CONFIG.vue_ui_skeleton }}
3557+
</template>
3558+
</Box>
3559+
3560+
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_wheel)">
35173561
<template #title>VueUiWheel</template>
35183562
<template #dev>
35193563
<WheelTest
@@ -3857,23 +3901,6 @@ const updateStep = ref(0);
38573901
{{ PROD_CONFIG.vue_ui_thermometer }}
38583902
</template>
38593903
</Box>
3860-
3861-
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_skeleton)">
3862-
<template #title>VueUiSkeleton</template>
3863-
<template #dev>
3864-
<SkeletonTest
3865-
:config="{ type: 'rating', style: { rating: { useSmiley: true, filled: true } } }"
3866-
/>
3867-
</template>
3868-
<template #prod>
3869-
<VueUiSkeleton
3870-
:config="{ type: 'rating', style: { rating: { useSmiley: true, filled: true } } }"
3871-
/>
3872-
</template>
3873-
<template #config>
3874-
{{ PROD_CONFIG.vue_ui_skeleton }}
3875-
</template>
3876-
</Box>
38773904

38783905
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_smiley)">
38793906
<template #title>VueUiSmiley</template>

src/Box.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ function copy() {
4141
<slot name="config"></slot>
4242
</code>
4343
</div>
44+
<div style="padding-left:24px">
45+
<slot name="general"/>
46+
</div>
4447
<div style="display: flex;flex-direction:row; gap:12px; align-items:center;justify-content:center;background:#2A2A2A;padding:12px">
4548
<div style="width:100%;padding:12px;">
4649
<div style="width:100%;text-align:center;color: #ff6400;margin-bottom:12px">DEV</div>

src/components/vue-ui-skeleton.vue

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,29 @@ const sparkline = ref(
258258
]
259259
)
260260
261+
function calcTickStart(angle, distance = 1) {
262+
const angleStart = 29.85;
263+
return {
264+
x: 200 + 160 * Math.cos(angleStart + angle * Math.PI / 180) * distance,
265+
y: 200 + 160 * Math.sin(angleStart + angle * Math.PI / 180) * distance
266+
}
267+
}
268+
269+
const ticks = computed(() => {
270+
const tickArray = [];
271+
const tickAmount = 100;
272+
for(let i = 0; i < tickAmount; i += 1) {
273+
tickArray.push({
274+
x1: calcTickStart((360 / tickAmount) * i).x,
275+
y1: calcTickStart((360 / tickAmount) * i).y,
276+
x2: calcTickStart((360 / tickAmount) * i, 0.9).x,
277+
y2: calcTickStart((360 / tickAmount) * i, 0.9).y,
278+
color: skeletonConfig.value.style.wheel.color
279+
})
280+
}
281+
return tickArray;
282+
})
283+
261284
</script>
262285

263286
<template>
@@ -271,6 +294,63 @@ const sparkline = ref(
271294
</g>
272295
</svg>
273296
</template>
297+
<!-- TYPE RINGS -->
298+
<template v-if="type === 'rings'">
299+
<svg data-cy="skeleton-rings" width="100%" viewBox="0 0 400 400" :style="`background:${skeletonConfig.style.backgroundColor}`">
300+
<circle
301+
:cx="200"
302+
:cy="200"
303+
:r="180"
304+
:fill="`${skeletonConfig.style.rings.color}${opacity[40]}`"
305+
/>
306+
<circle
307+
:cx="200"
308+
:cy="250"
309+
:r="130"
310+
:fill="`${skeletonConfig.style.rings.color}${opacity[60]}`"
311+
/>
312+
<circle
313+
:cx="200"
314+
:cy="290"
315+
:r="90"
316+
:fill="`${skeletonConfig.style.rings.color}${opacity[100]}`"
317+
/>
318+
</svg>
319+
</template>
320+
321+
<!-- TYPE WHEEL -->
322+
<template v-if="type === 'wheel'">
323+
<svg data-cy="skeleton-wheel" width="100%" viewBox="0 0 400 400" :style="`background:${skeletonConfig.style.backgroundColor}`">
324+
<line
325+
v-for="(tick, i) in ticks"
326+
:x1="tick.x1"
327+
:x2="tick.x2"
328+
:y1="tick.y1"
329+
:y2="tick.y2"
330+
:stroke="i < 66 ? tick.color : `${tick.color}${opacity[50]}`"
331+
:stroke-width="5"
332+
stroke-linecap="round"
333+
/>
334+
<circle
335+
:cx="200"
336+
:cy="200"
337+
:r="130"
338+
:stroke-width="3"
339+
:stroke="`${skeletonConfig.style.wheel.color}${opacity[50]}`"
340+
fill="none"
341+
/>
342+
<rect
343+
:fill="`${skeletonConfig.style.wheel.color}${opacity[50]}`"
344+
:rx="12"
345+
:x="160"
346+
:y="170"
347+
:height="60"
348+
:width="80"
349+
stroke="none"
350+
/>
351+
</svg>
352+
</template>
353+
274354
<!-- TYPE SPARKLINE -->
275355
<template v-if="type === 'sparkline'">
276356
<svg data-cy="skeleton-sparkline" width="100%" viewBox="0 0 150 32" :style="`background:${skeletonConfig.style.backgroundColor}`">

src/default_configs.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,12 @@
14741474
},
14751475
"pyramid": {
14761476
"color": "#e1e5e8"
1477+
},
1478+
"wheel": {
1479+
"color": "#e1e5e8"
1480+
},
1481+
"rings": {
1482+
"color": "#e1e5e8"
14771483
}
14781484
}
14791485
},

types/vue-data-ui.d.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2839,7 +2839,7 @@ declare module 'vue-data-ui' {
28392839
}>;
28402840

28412841
export type VueUiSkeletonConfig = {
2842-
type?: "bar" | "chestnut" | "donut" | "gauge" | "line" | "onion" | "quadrant" | "radar" | "rating" | "table" | "verticalBar" | "waffle" | "heatmap" | "candlestick" | "pyramid";
2842+
type?: "bar" | "chestnut" | "donut" | "gauge" | "line" | "onion" | "quadrant" | "radar" | "rating" | "table" | "verticalBar" | "waffle" | "heatmap" | "candlestick" | "pyramid" | "wheel" | "rings";
28432843
style?: {
28442844
backgroundColor?: string;
28452845
color?: string;
@@ -2942,6 +2942,15 @@ declare module 'vue-data-ui' {
29422942
strokeWidth?: number;
29432943
};
29442944
};
2945+
pyramid?: {
2946+
color?: string;
2947+
};
2948+
wheel?: {
2949+
color?: string;
2950+
};
2951+
rings?: {
2952+
color?: string;
2953+
}
29452954
};
29462955
};
29472956

0 commit comments

Comments
 (0)