Skip to content

Commit 9e5c208

Browse files
committed
Dev environment - Added VueUiOnion testing arena
1 parent 1f8f6da commit 9e5c208

File tree

2 files changed

+185
-2
lines changed

2 files changed

+185
-2
lines changed

TestingArena/ArenaVueUiOnion.vue

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
<script setup>
2+
import { ref, computed } from "vue";
3+
import LocalVueUiOnion from '../src/components/vue-ui-onion.vue';
4+
import LocalVueDataUi from '../src/components/vue-data-ui.vue';
5+
import Box from "./Box.vue";
6+
import convertArrayToObject from "./convertModel";
7+
8+
const dataset = ref([
9+
{
10+
name: "Serie 1",
11+
percentage: 21,
12+
value: 1200,
13+
},
14+
{
15+
name: "Serie 2",
16+
percentage: 34,
17+
value: 1000,
18+
},
19+
{
20+
name: "Serie 3",
21+
percentage: 55,
22+
value: 500
23+
},
24+
{
25+
name: "Serie 4",
26+
percentage: 79,
27+
value: 1280
28+
}
29+
])
30+
31+
const model = ref([
32+
{ key: 'useCssAnimation', def: true, type: 'checkbox' },
33+
{ key: 'useBlurOnHover', def: true, type: 'checkbox'},
34+
{ key: 'style.fontFamily', def: 'inherit', type: 'text', label: "fontFamily", category: 'general' },
35+
{ key: 'style.chart.backgroundColor', def: '#FFFFFF', type: 'color', label: 'backgroundColor', category: 'general' },
36+
{ key: 'style.chart.color', def: '#1A1A1A', type: 'color', label: 'textColor', category: 'general' },
37+
{ key: 'style.chart.useGradient', def: true, type: 'checkbox', label: 'useGradient', category: 'general' },
38+
{ key: 'style.chart.gradientIntensity', def: 20, min: 10, max: 40, type: 'range', label: 'gradientIntensity', category: 'general' },
39+
{ key: 'style.chart.layout.useDiv', def: true, type: 'checkbox'}, // DEPRECATED
40+
{ key: 'style.chart.layout.gutter.color', def: '#e1e5e8', type: 'color'},
41+
{ key: 'style.chart.layout.gutter.width', def: 0.62, type: 'range', min: 0.1, max: 1, step: 0.01},
42+
{ key: 'style.chart.layout.track.width', def: 0.62, type: 'range', min: 0.1, max: 1, step: 0.01},
43+
{ key: 'style.chart.layout.labels.show', def: true, type: 'checkbox'},
44+
{ key: 'style.chart.layout.labels.fontSize', def: 14, type: 'number', min: 8, max: 48},
45+
{ key: 'style.chart.layout.labels.color', def: '#1A1A1A', type: 'color'},
46+
{ key: 'style.chart.layout.labels.roundingValue', def: 2, type: 'number', min: 0, max: 12},
47+
{ key: 'style.chart.layout.labels.roundingPercentage', def: 2, type: 'number', min: 0, max: 12},
48+
{ key: 'style.chart.layout.labels.bold', def: true, type: 'checkbox'},
49+
{ key: 'style.chart.layout.labels.offsetY', def: 0, type: 'number', min: -100, max: 100},
50+
{ key: 'style.chart.layout.labels.offsetX', def: 0, type: 'number', min: -100, max: 100},
51+
{ key: 'style.chart.layout.labels.value.show', def: true, type: 'checkbox'},
52+
{ key: 'style.chart.layout.labels.percentage.show', def: true, type: 'checkbox'},
53+
{ key: 'style.chart.title.text', def: 'Lorem ipsum dolor sic amet', type: 'text', label: 'textContent', category: 'title' },
54+
{ key: 'style.chart.title.color', def: '#1A1A1A', type: 'color', label: 'textColor', category: 'title' },
55+
{ key: 'style.chart.title.fontSize', def: 20, type: 'number', min: 6, max: 48, label: 'fontSize', category: 'title' },
56+
{ key: 'style.chart.title.bold', def: true, type: 'checkbox', label: 'bold', category: 'title' },
57+
{ key: 'style.chart.title.subtitle.text', def: 'Lorem ipsum dolor sic amet', type: 'text', label: 'textContent', category: 'subtitle' },
58+
{ key: 'style.chart.title.subtitle.color', def: '#A1A1A1', type: 'color', label: 'textColor', category: 'subtitle' },
59+
{ key: 'style.chart.title.subtitle.fontSize', def: 16, type: 'number', min: 6, max: 42, label: 'fontSize', category: 'subtitle' },
60+
{ key: 'style.chart.title.subtitle.bold', def: false, type: 'checkbox', label: 'bold', category: 'subtitle' },
61+
{ key: 'style.chart.legend.show', def: true, type: 'checkbox', label: 'show', category: 'legend' },
62+
{ key: 'style.chart.legend.backgroundColor', def: '#FFFFFF', type: 'color', label: 'backgroundColor', category: 'legend' },
63+
{ key: 'style.chart.legend.color', def: '#1A1A1A', type: 'color', label: 'textColor', category: 'legend' },
64+
{ key: 'style.chart.legend.fontSize', def: 16, type: 'number', min: 6, max: 42, label: 'fontSize', category: 'legend' },
65+
{ key: 'style.chart.legend.bold', def: false, type: 'checkbox', label: 'bold', category: 'legend' },
66+
{ key: 'style.chart.legend.roundingValue', def: 0, type: 'number', min: 0, max: 6, label: ['rounding', 'is', 'value'], category: 'legend' },
67+
{ key: 'style.chart.legend.roundingPercentage', def: 0, type: 'number', min: 0, max: 6, label: 'percentageRounding', category: 'legend' },
68+
{ key: 'style.chart.legend.offsetY', def: 0, type: 'number', min: -100, max: 100}, // DEPRECATED (used with useDiv set to false)
69+
{ key: 'style.chart.tooltip.show', def: true, type: 'checkbox' },
70+
{ key: 'style.chart.tooltip.backgroundColor', def: '#FFFFFF', type: 'color' },
71+
{ key: 'style.chart.tooltip.color', def: '#1A1A1A', type: 'color' },
72+
{ key: 'style.chart.tooltip.fontSize', def: 14, type: 'number', min: 6, max: 24 },
73+
{ key: 'style.chart.tooltip.showValue', def: true, type: 'checkbox'},
74+
{ key: 'style.chart.tooltip.roundingValue', def: 0, type: 'number', min: 0, max: 6},
75+
{ key: 'style.chart.tooltip.roundingPercentage', def: 0, type: 'number', min: 0, max: 6 },
76+
{ key: 'style.chart.tooltip.showPercentage', def: true, type: 'checkbox' },
77+
{ key: 'style.chart.tooltip.roundingPercentage', def: 0, type: 'number', min: 0, max: 6},
78+
{ key: 'userOptions.show', def: true, type: 'checkbox'},
79+
{ key: 'table.show', def: false, type: 'checkbox', label: 'show', category: 'table' },
80+
{ key: 'table.responsiveBreakpoint', def: 400, type: 'number', min: 300, max: 800 },
81+
{ key: 'table.th.backgroundColor', def: '#FFFFFF', type: 'color' },
82+
{ key: 'table.th.color', def: '#1A1A1A', type: 'color' },
83+
{ key: 'table.th.outline', def: 'none', type: 'text' },
84+
{ key: 'table.td.backgroundColor', def: '#FFFFFF', type: 'color' },
85+
{ key: 'table.td.color', def: '#1A1A1A', type: 'color'},
86+
{ key: 'table.td.outline', def: 'none', type: 'text' },
87+
{ key: 'table.td.roundingValue', def: 0, type: 'number', min: 0, max: 6 },
88+
{ key: 'table.td.roundingPercentage', def: 0, type: 'number', min: 0, max: 6 },
89+
{ key: 'table.translations.value', def: 'Value', type: 'text'},
90+
{ key: 'table.translations.percentage', def: 'Percentage', type: 'text'},
91+
{ key: 'table.translations.serie', def: 'Serie', type: 'text'}
92+
])
93+
94+
const testCustomTooltip = ref(false);
95+
96+
const config = computed(() => {
97+
const c = convertArrayToObject(model.value);
98+
if(testCustomTooltip.value) {
99+
return {
100+
...c,
101+
style: {
102+
...c.style,
103+
chart: {
104+
...c.style.chart,
105+
tooltip: {
106+
...c.style.chart.tooltip,
107+
customFormat: ({ datapoint }) => {
108+
let html = '';
109+
console.log(datapoint);
110+
return "test"
111+
}
112+
}
113+
}
114+
}
115+
116+
}
117+
} else {
118+
return {
119+
...c
120+
}
121+
}
122+
});
123+
124+
const step = ref(0)
125+
126+
</script>
127+
128+
<template>
129+
<div style="margin: 12px 0">
130+
<input type="checkbox" v-model="testCustomTooltip" id="custom-tooltip" />
131+
<label for="custom-tooltip" style="color:#CCCCCC">Test custom tooltip</label>
132+
</div>
133+
134+
<Box>
135+
<template #title>VueUiOnion</template>
136+
137+
<template #local>
138+
<LocalVueUiOnion :dataset="dataset" :config="config" :key="`local_${step}`">
139+
</LocalVueUiOnion>
140+
</template>
141+
142+
<template #VDUI-local>
143+
<LocalVueDataUi component="VueUiOnion" :dataset="dataset" :config="config" :key="`VDUI-lodal_${step}`">
144+
</LocalVueDataUi>
145+
</template>
146+
147+
<template #build>
148+
<VueUiOnion :dataset="dataset" :config="config" :key="`build_${step}`">
149+
</VueUiOnion>
150+
</template>
151+
152+
<template #VDUI-build>
153+
<VueDataUi component="VueUiOnion" :dataset="dataset" :config="config" :key="`VDUI-build_${step}`">
154+
</VueDataUi>
155+
</template>
156+
157+
<template #knobs>
158+
<div
159+
style="display: flex; flex-direction: row; flex-wrap:wrap; align-items:center; width: 100%; color: #CCCCCC; gap:24px;">
160+
<div v-for="knob in model">
161+
<label style="font-size: 10px">{{ knob.key }}</label>
162+
<div
163+
style="display:flex; flex-direction:row; flex-wrap: wrap; align-items:center; gap:6px; height: 40px">
164+
<input v-if="!['none', 'select'].includes(knob.type)" :step="knob.step" :type="knob.type" :min="knob.min ?? 0"
165+
:max="knob.max ?? 0" v-model="knob.def" @change="step += 1">
166+
<select v-if="knob.type === 'select'" v-model="knob.def" @change="step += 1">
167+
<option v-for="opt in knob.options">{{ opt }}</option>
168+
</select>
169+
</div>
170+
</div>
171+
</div>
172+
</template>
173+
174+
<template #config>
175+
{{ config }}
176+
</template>
177+
</Box>
178+
</template>

src/App.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import ArenaVueUiGauge from "../TestingArena/ArenaVueUiGauge.vue";
1111
import ArenaVueUiWheel from "../TestingArena/ArenaVueUiWheel.vue";
1212
import ArenaVueUiTiremarks from "../TestingArena/ArenaVueUiTiremarks.vue";
1313
import ArenaVueUiChestnut from "../TestingArena/ArenaVueUiChestnut.vue";
14+
import ArenaVueUiOnion from "../TestingArena/ArenaVueUiOnion.vue";
1415
1516
const showOldArena = ref(false);
1617
@@ -24,10 +25,11 @@ const components = ref([
2425
"VueUiGauge",
2526
"VueUiWheel",
2627
"VueUiTiremarks",
27-
"VueUiChestnut"
28+
"VueUiChestnut",
29+
"VueUiOnion"
2830
]);
2931
30-
const selectedComponent = ref(components.value[9]);
32+
const selectedComponent = ref(components.value[10]);
3133
3234
</script>
3335

@@ -70,4 +72,7 @@ const selectedComponent = ref(components.value[9]);
7072

7173
<!-- 9 -->
7274
<ArenaVueUiChestnut v-if="selectedComponent === 'VueUiChestnut'" />
75+
76+
<!-- 10 -->
77+
<ArenaVueUiOnion v-if="selectedComponent === 'VueUiOnion'" />
7378
</template>

0 commit comments

Comments
 (0)