Skip to content

Commit ab38c17

Browse files
authored
Merge pull request #70 from graphieros/carousel-table
Carousel table - pre release
2 parents 58f645f + 1106ea1 commit ab38c17

File tree

11 files changed

+1040
-53
lines changed

11 files changed

+1040
-53
lines changed

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
# vue-data-ui
1010

1111
![npm](https://img.shields.io/npm/v/vue-data-ui)
12-
![Static Badge](https://img.shields.io/badge/components-54-blue)
13-
[![MadeWithVueJs.com shield](https://madewithvuejs.com/storage/repo-shields/4526-shield.svg)](https://madewithvuejs.com/p/vue-data-ui/shield-link)
12+
![Static Badge](https://img.shields.io/badge/components-55-blue)
1413
![GitHub issues](https://img.shields.io/github/issues/graphieros/vue-data-ui)
1514
[![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE)
15+
[![MadeWithVueJs.com shield](https://madewithvuejs.com/storage/repo-shields/4526-shield.svg)](https://madewithvuejs.com/p/vue-data-ui/shield-link)
1616
![npm](https://img.shields.io/npm/dt/vue-data-ui)
1717

1818
[Interactive documentation](https://vue-data-ui.graphieros.com/)
@@ -73,6 +73,7 @@ Available components
7373
- [VueUiTableHeatmap](https://vue-data-ui.graphieros.com/docs#vue-ui-table-heatmap)
7474
- [VueUiTableSparkline](https://vue-data-ui.graphieros.com/docs#vue-ui-table-sparkline)
7575
- [VueUiTable](https://vue-data-ui.graphieros.com/docs#vue-ui-table)
76+
- [VueUiCarouselTable](https://vue-data-ui.graphieros.com/docs#vue-ui-carousel-table)
7677

7778
## Rating
7879

@@ -353,14 +354,14 @@ From the dataset you pass into the props, this component will produce the most a
353354

354355
### Mini charts
355356

356-
| Name | dataset type | config type | emits / exposed methods | slots | custom tooltip | themes |
357-
| --------------------- | ---------------------------------- | --------------------------- | ----------------------- | -------------------------- | -------------- | ------ |
358-
| `VueUiSparkline` | `VueUiSparklineDatasetItem[]` | `VueUiSparklineConfig` | `@selectDatapoint` | `#svg`, `#before` |||
359-
| `VueUiSparkbar` | `VueUiSparkbarDatasetItem[]` | `VueUiSparkbarConfig` | `@selectDatapoint` | `#data-label`, `#title` |||
360-
| `VueUiSparkStackbar` | `VueUiSparkStackbarDatasetItem[]` | `VueUiSparkStackbarConfig` | `@selectDatapoint` | |||
361-
| `VueUiSparkHistogram` | `VueUiSparkHistogramDatasetItem[]` | `VueUiSparkHistogramConfig` | `@selectDatapoint` | |||
362-
| `VueUiSparkGauge` | `VueUiSparkGaugeDataset` | `VueUiSparkGaugeConfig` || |||
363-
| `VueUiSparkTrend` | `number[]` | `VueUiSparkTrendConfig` || |||
357+
| Name | dataset type | config type | emits / exposed methods | slots | custom tooltip | themes |
358+
| --------------------- | ---------------------------------- | --------------------------- | ----------------------- | ----------------------- | -------------- | ------ |
359+
| `VueUiSparkline` | `VueUiSparklineDatasetItem[]` | `VueUiSparklineConfig` | `@selectDatapoint` | `#svg`, `#before` |||
360+
| `VueUiSparkbar` | `VueUiSparkbarDatasetItem[]` | `VueUiSparkbarConfig` | `@selectDatapoint` | `#data-label`, `#title` |||
361+
| `VueUiSparkStackbar` | `VueUiSparkStackbarDatasetItem[]` | `VueUiSparkStackbarConfig` | `@selectDatapoint` ||||
362+
| `VueUiSparkHistogram` | `VueUiSparkHistogramDatasetItem[]` | `VueUiSparkHistogramConfig` | `@selectDatapoint` ||||
363+
| `VueUiSparkGauge` | `VueUiSparkGaugeDataset` | `VueUiSparkGaugeConfig` |||||
364+
| `VueUiSparkTrend` | `number[]` | `VueUiSparkTrendConfig` |||||
364365

365366
### Charts
366367

@@ -404,11 +405,12 @@ From the dataset you pass into the props, this component will produce the most a
404405

405406
### Data tables
406407

407-
| Name | dataset type | config type | emits / exposed methods | slots | themes |
408-
| --------------------- | ---------------------------------- | --------------------------- | --------------------------------------------- | --------------------------------------------------------------- | ------ |
409-
| `VueUiTable` | `VueUiTableDataset` | `VueUiTableConfig` ||||
410-
| `VueUiTableHeatmap` | `VueUiTableHeatmapDatasetItem[]` | `VueUiTableHeatmapConfig` | `generatePdf`, `generateCsv`, `generateImage` | `#caption`, `#rowTitle`, `#cell`, `#sum`, `#average`, `#median` ||
411-
| `VueUiTableSparkline` | `VueUiTableSparklineDatasetItem[]` | `VueUiTableSparklineConfig` | `generatePdf`, `generateCsv`, `generateImage` |||
408+
| Name | dataset type | config type | emits / exposed methods | slots | themes |
409+
| --------------------- | ---------------------------------- | --------------------------- | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ------ |
410+
| `VueUiTable` | `VueUiTableDataset` | `VueUiTableConfig` ||||
411+
| `VueUiTableHeatmap` | `VueUiTableHeatmapDatasetItem[]` | `VueUiTableHeatmapConfig` | `generatePdf`, `generateCsv`, `generateImage` | `#caption`, `#rowTitle`, `#cell`, `#sum`, `#average`, `#median` ||
412+
| `VueUiTableSparkline` | `VueUiTableSparklineDatasetItem[]` | `VueUiTableSparklineConfig` | `generatePdf`, `generateCsv`, `generateImage` |||
413+
| `VueUiCarouselTable` | `VueUiCarouselTableDataset` | `VueUiCarouselTableConfig` | `generatePdf`, `generateImage`, `generateCsv`, `toggleAnimation`, `pauseAnimation`, `resumeAnimation` | `#caption`, `#th`, `#td` ||
412414

413415
### Rating
414416

@@ -497,6 +499,7 @@ User options actions available per chart:
497499
| VueUi3dBar | optionPdf, optionImg, optionCsv, optionTable, optionFullscreen |
498500
| VueUiAgePyramid | optionTooltip, optionPdf, optionImg, optionCsv, optionTable, optionFullscreen |
499501
| VueUiCandlestick | optionTooltip, optionPdf, optionImg, optionCsv, optionTable, optionFullscreen |
502+
| VueUiCarouselTable | optionPdf, optionImg, optionCsv, optionAnimation, optionFullscreen |
500503
| VueUiChestnut | optionPdf, optionImg, optionCsv, optionTable, optionFullscreen |
501504
| VueUiDonut | optionTooltip, optionPdf, optionImg, optionCsv, optionTable, optionLabels, optionFullscreen |
502505
| VueUiDonutEvolution | optionPdf, optionImg, optionCsv, optionTable, optionFullscreen |
@@ -581,6 +584,7 @@ However the folowing charts can be made fully responsive, making them better to
581584
| VueUi3dBar | - |
582585
| VueUiAgePyramid ||
583586
| VueUiCandlestick ||
587+
| VueUiCarouselTable | - |
584588
| VueUiChestnut | - |
585589
| VueUiDonut ||
586590
| VueUiDonutEvolution | - |
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
<script setup>
2+
import { ref, computed, onMounted } from "vue";
3+
import LocalVueUiCarouselTable from '../src/components/vue-ui-carousel-table.vue';
4+
import LocalVueDataUi from '../src/components/vue-data-ui.vue';
5+
import Box from "./Box.vue";
6+
import convertArrayToObject from "./convertModel";
7+
import { useArena } from "../src/useArena";
8+
9+
const { local, build, vduiLocal, vduiBuild, toggleTable, toggleLabels, toggleStack } = useArena()
10+
11+
const model = ref([
12+
{ key: 'responsiveBreakpoint', def: 400, type: 'number', min: 300, max: 800 },
13+
{ key: 'animation.use', def: true, type: 'checkbox'},
14+
{ key: 'animation.speedMs', def: 1000, type: 'number', type: 'range', min: 200, max: 2000},
15+
{ key: 'animation.pauseOnHover', def: true, type: 'checkbox'},
16+
{ key: 'border.size', def: 0, type: 'number', min: 0, max: 12 },
17+
{ key: 'border.color', def: '#1A1A1A', type: 'color'},
18+
19+
{ key: 'style.backgroundColor', def: '#FFFFFF', type: 'color' },
20+
{ key: 'style.color', def: '#1A1A1A', type: 'color' },
21+
{ key: 'style.fontFamily', def: 'inherit', type: 'text' },
22+
23+
{ key: 'caption.text', def: 'Lorem ipsum dolor sit amet', type: 'text'},
24+
25+
{ key: 'caption.padding.top', def: 12, type: 'number', min: 0, max: 24},
26+
{ key: 'caption.padding.right', def: 12, type: 'number', min: 0, max: 24},
27+
{ key: 'caption.padding.bottom', def: 12, type: 'number', min: 0, max: 24},
28+
{ key: 'caption.padding.left', def: 12, type: 'number', min: 0, max: 24},
29+
30+
{ key: 'caption.style.backgroundColor', def: '#FFFFFF', type: 'color'},
31+
{ key: 'caption.style.color', def: '#1A1A1A', type: 'color'},
32+
{ key: 'caption.style.fontSize', def: '16px', type: 'text'},
33+
{ key: 'caption.style.fontWeight', def: 'bold', type: 'text'},
34+
{ key: 'caption.style.textAlign', def: 'left', type: 'select', options: ['left', 'center', 'right']},
35+
36+
{ key: 'thead.tr.style.backgroundColor', def: '#FFFFFF', type: 'color'},
37+
{ key: 'thead.tr.style.boxShadow', def: '0px 6px 12px -6px #1A1A1A50' },
38+
39+
{ key: 'thead.tr.border.size', def: 0, type: 'number', min: 0, max: 12 },
40+
{ key: 'thead.tr.border.color', def: '#1A1A1A', type: 'color'},
41+
{ key: 'thead.tr.th.border.size', def: 0, type: 'number', min: 0, max: 12 },
42+
{ key: 'thead.tr.th.border.color', def: '#1A1A1A', type: 'color'},
43+
{ key: 'thead.tr.th.style.textAlign', def: 'right', type: 'select', options: ['left', 'center', 'right']},
44+
{ key: 'thead.tr.th.style.fontVariantNumeric', def: 'tabular-nums', type: 'text'},
45+
46+
{ key: 'thead.tr.th.padding.top', def: 0, type: 'number', min: 0, max: 24},
47+
{ key: 'thead.tr.th.padding.right', def: 12, type: 'number', min: 0, max: 24},
48+
{ key: 'thead.tr.th.padding.bottom', def: 0, type: 'number', min: 0, max: 24},
49+
{ key: 'thead.tr.th.padding.left', def: 0, type: 'number', min: 0, max: 24},
50+
51+
{ key: 'tbody.tr.visible', def: 5, type: 'number', min: 1, max: 100},
52+
{ key: 'tbody.tr.height', def: 32, type: 'number', min: 12, max: 100 },
53+
{ key: 'tbody.tr.style.backgroundColor', def: '#FFFFFF', type: 'color'},
54+
{ key: 'tbody.tr.style.color', def: '#1A1A1A', type: 'color'},
55+
56+
{ key: 'tbody.tr.border.size', def: 0, type: 'number', min: 0, max: 12 },
57+
{ key: 'tbody.tr.border.color', def: '#1A1A1A', type: 'color'},
58+
59+
{ key: 'tbody.tr.td.alternateColor', def: true, type: 'checkbox'},
60+
{ key: 'tbody.tr.td.alternateOpacity', def: 0.5, type: 'range', min: 0, max: 1, step: 0.01},
61+
{ key: 'tbody.tr.td.style.fontVariantNumeric', def: 'tabular-nums', type: 'text'},
62+
{ key: 'tbody.tr.td.style.textAlign', def: 'right', type:'select', options: ['left', 'center', 'right']},
63+
{ key: 'tbody.tr.td.style.backgroundColor', def: '#e1e5e8', type: 'color' },
64+
65+
{ key: 'tbody.tr.td.border.size', def: 0, type: 'number', min: 0, max: 12 },
66+
{ key: 'tbody.tr.td.border.color', def: '#1A1A1A', type: 'color'},
67+
68+
{ key: 'tbody.tr.td.padding.top', def: 0, type: 'number', min: 0, max: 24},
69+
{ key: 'tbody.tr.td.padding.right', def: 12, type: 'number', min: 0, max: 24},
70+
{ key: 'tbody.tr.td.padding.bottom', def: 0, type: 'number', min: 0, max: 24},
71+
{ key: 'tbody.tr.td.padding.left', def: 0, type: 'number', min: 0, max: 24},
72+
73+
{ key: 'userOptions.show', def: true, type: 'checkbox'},
74+
{ key: 'userOptions.buttons.pdf', def: true, type: 'checkbox' },
75+
{ key: 'userOptions.buttons.img', def: true, type: 'checkbox' },
76+
{ key: 'userOptions.buttons.csv', def: true, type: 'checkbox' },
77+
{ key: 'userOptions.buttons.animation', def: true, type: 'checkbox' },
78+
{ key: 'userOptions.buttons.fullscreen', def: true, type: 'checkbox' },
79+
80+
{ key: 'userOptions.buttonTitles.pdf', def: 'DOWNLOAD PDF', type: 'text'},
81+
{ key: 'userOptions.buttonTitles.csv', def: 'DOWNLOAD CSV', type: 'text'},
82+
{ key: 'userOptions.buttonTitles.img', def: 'DOWNLOAD PNG', type: 'text'},
83+
{ key: 'userOptions.buttonTitles.animation', def: 'TOGGLE ANIMATION', type: 'text'},
84+
{ key: 'userOptions.buttonTitles.fullscreen', def: 'TOGGLE FULLSCREEN', type: 'text'},
85+
{ key: 'userOptions.buttonTitles.open', def: 'OPEN OPTIONS', type: 'text'},
86+
{ key: 'userOptions.buttonTitles.close', def: 'CLOSE OPTIONS', type: 'text'},
87+
])
88+
89+
const config = computed(() => {
90+
const c = convertArrayToObject(model.value);
91+
return {
92+
...c
93+
}
94+
})
95+
96+
function generateBody(n) {
97+
let arr = [];
98+
for (let i = 0; i < n; i += 1) {
99+
arr.push([
100+
Math.round(Math.random()*Math.random()*1000000),
101+
Math.round(Math.random()*Math.random()*1000000),
102+
Math.round(Math.random()*Math.random()*1000000),
103+
Math.round(Math.random()*Math.random()*1000000),
104+
Math.round(Math.random()*Math.random()*1000000),
105+
Math.round(Math.random()*Math.random()*1000000),
106+
Math.round(Math.random()*Math.random()*1000000),
107+
])
108+
}
109+
return arr
110+
}
111+
112+
const dataset = ref({
113+
head: ['Column 1 has a long name', 'col2', 'col3', 'col4', 'col 5', 'col 6', 'col 7'],
114+
body: generateBody(12)
115+
})
116+
117+
const step = ref(0)
118+
119+
const localComponent = ref(null);
120+
const buildComponent = ref(null);
121+
const vduiLocalComponent = ref(null);
122+
const vduiBuildComponent = ref(null);
123+
124+
function toggleAnimLocal() {
125+
localComponent.value.toggleAnimation();
126+
}
127+
function pauseLocal() {
128+
localComponent.value.pauseAnimation();
129+
}
130+
function resumeLocal() {
131+
localComponent.value.resumeAnimation();
132+
}
133+
134+
function toggleAnimVduiLocal() {
135+
vduiLocalComponent.value.toggleAnimation();
136+
}
137+
138+
function pauseVduiLocal() {
139+
vduiLocalComponent.value.pauseAnimation();
140+
}
141+
142+
function resumeVduiLocal() {
143+
vduiLocalComponent.value.resumeAnimation();
144+
}
145+
146+
function toggleAnimBuild() {
147+
if(buildComponent.value) {
148+
buildComponent.value.toggleAnimation();
149+
}
150+
}
151+
152+
function pauseBuild() {
153+
buildComponent.value.pauseAnimation();
154+
}
155+
156+
function resumeBuild() {
157+
buildComponent.value.resumeAnimation();
158+
}
159+
160+
function toggleAnimVduiBuild() {
161+
if(vduiBuildComponent.value) {
162+
vduiBuildComponent.value.toggleAnimation();
163+
}
164+
}
165+
166+
function pauseVduiBuild() {
167+
vduiBuildComponent.value.pauseAnimation();
168+
}
169+
170+
function resumeVduiBuild() {
171+
vduiBuildComponent.value.resumeAnimation();
172+
}
173+
174+
</script>
175+
176+
<template>
177+
<Box>
178+
<template #title>VueUiCarouselTable</template>
179+
180+
<template #local>
181+
<button @click="toggleAnimLocal">TOGGLE ANIMATION (public)</button>
182+
<button @click="pauseLocal">PAUSE ANIMATION (public)</button>
183+
<button @click="resumeLocal">RESUME ANIMATION (public)</button>
184+
<LocalVueUiCarouselTable
185+
:config="config"
186+
:dataset="dataset"
187+
ref="localComponent"
188+
>
189+
<template #caption>
190+
Lorem ipsum dolor
191+
</template>
192+
<template #th="{th}">
193+
{{ th }}
194+
</template>
195+
</LocalVueUiCarouselTable>
196+
</template>
197+
198+
<template #VDUI-local>
199+
<button @click="toggleAnimVduiLocal">TOGGLE ANIMATION (public)</button>
200+
<button @click="pauseVduiLocal">PAUSE ANIMATION (public)</button>
201+
<button @click="resumeVduiLocal">RESUME ANIMATION (public)</button>
202+
<LocalVueDataUi
203+
component="VueUiCarouselTable"
204+
ref="vduiLocalComponent"
205+
:config="config"
206+
:dataset="dataset"
207+
>
208+
209+
</LocalVueDataUi>
210+
</template>
211+
212+
<template #build>
213+
<button @click="toggleAnimBuild">TOGGLE ANIMATION (public)</button>
214+
<button @click="pauseBuild">PAUSE ANIMATION (public)</button>
215+
<button @click="resumeBuild">RESUME ANIMATION (public)</button>
216+
<VueUiCarouselTable
217+
ref="buildComponent"
218+
:dataset="dataset"
219+
:config="config"
220+
>
221+
</VueUiCarouselTable>
222+
</template>
223+
224+
<template #VDUI-build>
225+
<button @click="toggleAnimVduiBuild">TOGGLE ANIMATION (public)</button>
226+
<button @click="pauseVduiBuild">PAUSE ANIMATION (public)</button>
227+
<button @click="resumeVduiBuild">RESUME ANIMATION (public)</button>
228+
<VueDataUi
229+
ref="vduiBuildComponent"
230+
component="VueUiCarouselTable"
231+
:dataset="dataset"
232+
:config="config"
233+
>
234+
235+
</VueDataUi>
236+
</template>
237+
238+
<template #knobs>
239+
<div
240+
style="display: flex; flex-direction: row; flex-wrap:wrap; align-items:center; width: 100%; color: #CCCCCC; gap:24px;">
241+
<div v-for="knob in model">
242+
<label style="font-size: 10px">{{ knob.key }}</label>
243+
<div
244+
style="display:flex; flex-direction:row; flex-wrap: wrap; align-items:center; gap:6px; height: 40px">
245+
<input v-if="!['none', 'select'].includes(knob.type)" :step="knob.step" :type="knob.type" :min="knob.min ?? 0"
246+
:max="knob.max ?? 0" v-model="knob.def" @change="step += 1">
247+
<select v-if="knob.type === 'select'" v-model="knob.def" @change="step += 1">
248+
<option v-for="opt in knob.options">{{ opt }}</option>
249+
</select>
250+
</div>
251+
</div>
252+
</div>
253+
</template>
254+
255+
<template #config>
256+
{{ config }}
257+
</template>
258+
259+
</Box>
260+
</template>

0 commit comments

Comments
 (0)