Skip to content

Commit afc6a32

Browse files
committed
Fiat lux
0 parents  commit afc6a32

File tree

7 files changed

+1285
-0
lines changed

7 files changed

+1285
-0
lines changed

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
TODO.txt

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"vueIndentScriptAndStyle": true
7+
}

boilerplate.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
export default ({
2+
component,
3+
config,
4+
dataset,
5+
useTypescript,
6+
useComputedDataset,
7+
useComputedConfig,
8+
configType,
9+
datasetType,
10+
isDatasetArray,
11+
componentSlots,
12+
componentLink
13+
}) => {
14+
15+
const dsType = useTypescript ? `<${`${datasetType}${isDatasetArray ? '[]' : ''}`}>` : '';
16+
const confType = useTypescript ? `<${configType}>` : '';
17+
const ds = JSON.stringify(dataset);
18+
const conf = JSON.stringify(config);
19+
20+
const sourceSlot = `
21+
<!-- #source slot: display the source for your data -->
22+
<!--<template #source>
23+
<small>Source: <cite>My source</cite></small>
24+
</template>-->
25+
`;
26+
27+
return `
28+
<script setup${useTypescript ? ' lang="ts"' : ''}>
29+
import { ${[useComputedConfig, useComputedDataset].includes(false) ? 'ref, ' : ''}${useComputedConfig || useComputedDataset ? 'computed ' : ''}} from "vue";
30+
import { VueDataUi${useTypescript ? `, type ${datasetType}, type ${configType} }` : '}'} from "vue-data-ui";
31+
32+
const dataset = ${useComputedDataset ? `computed${dsType}(() => {
33+
return ${ds};
34+
})` : `ref${dsType}(${ds})`};
35+
36+
/**
37+
* This is the default config.
38+
* It is not required to send it all to the component.
39+
* You can keep only the modified attributes you need.
40+
*/
41+
const config = ${useComputedConfig ? `computed${confType}(() => {
42+
return ${conf};
43+
})` : `ref${confType}(${conf})`};
44+
45+
</script>
46+
47+
<template>
48+
<div :style="{ width: '600px' }">
49+
<VueDataUi
50+
component="${component}"
51+
:dataset="dataset"
52+
:config="config"
53+
>
54+
<!-- Include slots here -->
55+
<!-- For more info on slots, check the slots tab at https://vue-data-ui.graphieros.com/docs#${componentLink} -->
56+
${ componentSlots.includes('source') ? sourceSlot : ''}
57+
</VueDataUi>
58+
</div>
59+
</template>
60+
`;
61+
};

datasets.js

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
export default (componentName) => {
2+
const datasets = {
3+
VueUiXy: [
4+
{
5+
name: 'Serie',
6+
series: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34],
7+
type: 'line',
8+
dataLabels: true,
9+
}
10+
],
11+
VueUiDonut: [
12+
{
13+
name: "Series 1",
14+
color: "#1f77b4",
15+
values: [100]
16+
},
17+
{
18+
name: "Series 2",
19+
color: "#aec7e8",
20+
values: [200]
21+
},
22+
{
23+
name: "Series 3",
24+
color: "#ff7f0e",
25+
values: [300, 1]
26+
},
27+
],
28+
VueUiStackbar: [
29+
{
30+
name: "Serie 1",
31+
series: [19, 20.07, 30, 40, 50, 60],
32+
},
33+
{
34+
name: "Serie 2",
35+
series: [13, 8, 9, 13, 25, 27],
36+
},
37+
{
38+
name: "Serie 3",
39+
series: [13, 10, 9, 13, 25, 19],
40+
},
41+
{
42+
name: "Serie 4",
43+
series: [25, 23, 9, 13, 25, 31],
44+
45+
},
46+
],
47+
VueUiSparkline: [
48+
{ period: 'T0', value: 0 },
49+
{ period: 'T1', value: 1 },
50+
{ period: 'T2', value: 1 },
51+
{ period: 'T3', value: 2 },
52+
{ period: 'T4', value: 3 },
53+
{ period: 'T5', value: 5 },
54+
{ period: 'T6', value: 8 },
55+
{ period: 'T7', value: 13 },
56+
{ period: 'T8', value: 21 },
57+
{ period: 'T9', value: 34 },
58+
],
59+
VueUiSparkbar: [
60+
{
61+
name: "quality",
62+
value: 61.953,
63+
rounding: 2,
64+
prefix: '',
65+
suffix: "%",
66+
},
67+
{
68+
name: "popularity",
69+
value: 2.0412,
70+
rounding: 2,
71+
prefix: '',
72+
suffix: "%",
73+
},
74+
{
75+
name: "maintenance",
76+
value: 33.3291,
77+
rounding: 2,
78+
prefix: '',
79+
suffix: "%",
80+
},
81+
],
82+
VueUiSparkStackbar: [
83+
{
84+
name: "Vue",
85+
value: 258,
86+
color: "#1f77b4",
87+
},
88+
{
89+
name: "Javascript",
90+
value: 36,
91+
color: "#aec7e8",
92+
},
93+
{
94+
name: "Other",
95+
value: 16,
96+
color: "#ff7f0e",
97+
},
98+
],
99+
VueUiGauge: {
100+
base: 0,
101+
value: 4.2,
102+
series: [
103+
{
104+
from: 1,
105+
to: 3,
106+
color: "#ff6400",
107+
name: 'bad'
108+
},
109+
{
110+
from: 3,
111+
to: 4,
112+
color: "#5f8bee",
113+
name: 'acceptable'
114+
},
115+
{
116+
from: 4,
117+
to: 5,
118+
color: "#42d392",
119+
name: 'very good'
120+
},
121+
]
122+
}
123+
}
124+
125+
return datasets[componentName]
126+
}

0 commit comments

Comments
 (0)