1+ <script setup>
2+ import { ref , computed } from " vue" ;
3+ import LocalVueUiTableSparkline from ' ../src/components/vue-ui-table-sparkline.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+ values: [0 , 1 , 2 , 3 , 5 , 8 , 13 ],
12+ },
13+ {
14+ name: " Serie 2" ,
15+ values: [8.2 , 12 , 13 , 25 , 31 , 42 , 53 , 42 , 31 , 25 , 13 , 12 , 8 ],
16+ },
17+ {
18+ name: " Serie 3" ,
19+ values: [66 , 22 , 33 , 12 , 55 , 64 , 75 , 64 , 55 , 12 , 33 , 22 , 66 ],
20+ },
21+ {
22+ name: " Serie 4" ,
23+ values: [54 , 44 , 34 , 12 , 32 , 26 , 33 , 26 , 32 , 12 , 34 , 44 , 54 ],
24+ },
25+ {
26+ name: " Serie 5" ,
27+ values: [12 , 14 , 18 , 25 , 32 , 64 , 77 , 64 , 32 , 25 , 18 , 14 , 12 ],
28+ },
29+ ])
30+
31+ const model = ref ([
32+ { key: ' responsiveBreakpoint' , def: 500 , type: ' number' , min: 300 , max: 800 },
33+ { key: ' showAverage' , def: true , type: ' checkbox' },
34+ { key: ' showMedian' , def: true , type: ' checkbox' },
35+ { key: ' showTotal' , def: true , type: ' checkbox' },
36+ { key: ' roundingAverage' , def: 2 , type: ' number' , min: 0 , max: 12 },
37+ { key: ' roundingMedian' , def: 2 , type: ' number' , min: 0 , max: 12 },
38+ { key: ' roundingValues' , def: 2 , type: ' number' , min: 0 , max: 12 },
39+ { key: ' roundingTotal' , def: 2 , type: ' number' , min: 0 , max: 12 },
40+ { key: ' showSparklines' , def: true , type: ' checkbox' },
41+ { key: ' fontFamily' , def: ' inherit' , type: ' text' },
42+ { key: ' sparkline.useGradient' , def: true , type: ' checkbox' },
43+ { key: ' sparkline.showArea' , def: true , type: ' checkbox' },
44+ { key: ' sparkline.strokeWidth' , def: 3 , type: ' number' , min: 1 , max: 12 },
45+ { key: ' sparkline.type' , def: ' line' , type: ' select' , options: [' line' , ' bar' ]},
46+ { key: ' sparkline.smooth' , def: true , type: ' checkbox' },
47+ { key: ' sparkline.animation.show' , def: true , type: ' checkbox' },
48+ { key: ' sparkline.animation.animationFrames' , def: 360 , type: ' number' , min: 60 , max: 1000 },
49+ { key: ' translations.serie' , def: ' Serie' , type: ' text' },
50+ { key: ' translations.total' , def: ' Total' , type: ' text' },
51+ { key: ' translations.average' , def: ' Average' , type: ' text' },
52+ { key: ' translations.median' , def: ' Median' , type: ' text' },
53+ { key: ' translations.chart' , def: ' Evolution' , type: ' text' },
54+ { key: ' title.backgroundColor' , def: ' #FFFFFF' , type: ' color' },
55+ { key: ' title.text' , def: ' Lorem ipsum dolor sot amet' , type: ' text' },
56+ { key: ' title.fontSize' , def: 18 , type: ' number' , min: 8 , max: 48 },
57+ { key: ' title.color' , def: ' #1A1A1A' , type: ' color' },
58+ { key: ' title.bold' , def: true , type: ' checkbox' },
59+ { key: ' title.textAlign' , def: ' center' , type: ' select' , options: [' left' , ' center' , ' right' ]},
60+ { key: ' title.subtitle.text' , def: ' Lorem ipsum dolor sit amet' , type: ' text' },
61+ { key: ' title.subtitle.color' , def: ' #1A1A1A' , type: ' color' },
62+ { key: ' title.subtitle.fontSize' , def: 14 , type: ' number' , min: 8 , max: 48 },
63+ { key: ' title.subtitle.bold' , def: false , type: ' checkbox' },
64+ { key: ' thead.backgroundColor' , def: ' #FFFFFF' , type: ' color' },
65+ { key: ' thead.color' , def: ' #1A1A1A' , type: ' color' },
66+ { key: ' thead.fontSize' , def: 14 , type: ' number' , min: 8 , max: 24 },
67+ { key: ' thead.outline' , def: ' none' , type: ' text' },
68+ { key: ' thead.textAlign' , def: ' left' , type: ' select' , options: [' left' , ' center' , ' right' ]},
69+ { key: ' thead.bold' , def: false , type: ' checkbox' },
70+ { key: ' tbody.backgroundColor' , def: ' #FFFFFF' , type: ' color' },
71+ { key: ' tbody.color' , def: ' #1A1A1A' , type: ' color' },
72+ { key: ' tbody.fontSize' , def: 14 , type: ' number' , min: 8 , max: 24 },
73+ { key: ' tbody.outline' , def: ' none' , type: ' text' },
74+ { key: ' tbody.textAlign' , def: ' left' , type: ' select' , options: [' left' , ' center' , ' right' ]},
75+ { key: ' tbody.bold' , def: false , type: ' checkbox' },
76+ { key: ' userOptions.show' , def: true , type: ' checkbox' }
77+ ])
78+
79+ const config = computed (() => convertArrayToObject (model .value ))
80+
81+ const step = ref (0 )
82+
83+ </script >
84+
85+ <template >
86+ <Box >
87+ <template #title >VueUiTableSparkline</template >
88+
89+ <template #local >
90+ <LocalVueUiTableSparkline :dataset =" dataset" :config =" config" :key =" `local_${step}`" >
91+ </LocalVueUiTableSparkline >
92+ </template >
93+
94+ <template #VDUI-local >
95+ <LocalVueDataUi component =" VueUiTableSparkline" :dataset =" dataset" :config =" config" :key =" `vdui_local_${step}`" >
96+ </LocalVueDataUi >
97+ </template >
98+
99+ <template #build >
100+ <VueUiTableSparkline :dataset =" dataset" :config =" config" :key =" `build_${step}`" >
101+ </VueUiTableSparkline >
102+ </template >
103+
104+ <template #VDUI-build >
105+ <VueDataUi component =" VueUiTableSparkline" :dataset =" dataset" :config =" config" :key =" `vdui_build_${step}`" >
106+ </VueDataUi >
107+ </template >
108+
109+ <template #knobs >
110+ <div
111+ style =" display : flex ; flex-direction : row ; flex-wrap :wrap ; align-items :center ; width : 100% ; color : #CCCCCC ; gap :24px ;" >
112+ <div v-for =" knob in model" >
113+ <label style =" font-size : 10px " >{{ knob.key }}</label >
114+ <div
115+ style =" display :flex ; flex-direction :row ; flex-wrap : wrap ; align-items :center ; gap :6px ; height : 40px " >
116+ <input v-if =" !['none', 'select'].includes(knob.type)" :step =" knob.step" :type =" knob.type"
117+ :min =" knob.min ?? 0" :max =" knob.max ?? 0" v-model =" knob.def" @change =" step += 1" >
118+ <select v-if =" knob.type === 'select'" v-model =" knob.def" @change =" step += 1" >
119+ <option v-for =" opt in knob.options" >{{ opt }}</option >
120+ </select >
121+ </div >
122+ </div >
123+ </div >
124+ </template >
125+
126+ <template #config >
127+ {{ config }}
128+ </template >
129+ </Box >
130+ </template >
0 commit comments