-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemplateExample.vue
More file actions
125 lines (110 loc) · 2.13 KB
/
TemplateExample.vue
File metadata and controls
125 lines (110 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<template>
<VStepperForm
v-model="answers"
v-bind="formSettings"
:validationSchema="validationSchema"
@submit="submitForm"
/>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import {
object as yupObject,
string as yupString,
} from 'yup';
interface Props {
open?: HTMLPreElement | null;
}
defineProps<Props>();
const answers = ref({
bar: null,
foo: null,
});
const pages = [
{
fields: [
{
label: 'Foo',
name: 'foo',
required: true,
type: 'text' as const,
},
],
title: 'Page 1',
},
{
fields: [
{
label: 'Bar',
name: 'bar',
required: true,
type: 'text' as const,
},
],
title: 'Page 2',
},
];
const validationSchema = yupObject({
bar: yupString().required(),
foo: yupString().required(),
});
const formSettings = ref({
// altLabels: true,
// autoPage: true,
// autoPageDelay: 2000,
// bgColor: 'secondary',
// border: 'lg',
// color: 'yellow',
// density: 'default' as const,
// disabled: true,
// editable: false,
// elevation: 10,
// errorIcon: 'fas fa-cog',
// fieldColumns: {
// lg: 12,
// md: 12,
// sm: 12,
// xl: 12,
// },
// flat: true,
// height: '900px',
// hideActions: true,
// hideDetails: true,
// maxHeight: '50px',
// maxWidth: '50px',
// minHeight: '900px',
// minWidth: '900px',
// navButtonSize: 'small',
// nextText: 'hop back',
pages: pages,
// prevText: 'hop forward',
// rounded: 'pill',
// selectedClass: 'foobar',
// summaryColumns: { sm: 2 },
// theme: 'light',
// tile: true,
title: 'Basic Form',
validateOn: 'blur' as const,
// validateOnMount: true,
// variant: 'outlined',
// width: '50px',
});
function submitForm(): void {
console.log('submitForm');
}
const templateCode = `<template>
<VColorField v-model="color" />
</template>
`;
const scriptCode = `\<script setup\>
const color = ref(null);
\</script\>`;
defineExpose({
exampleCode: {
desc: 'A simple example of a color picker field using the <code class="ic">VTextField</code> component. Clicking on the icon will open the color picker.',
script: scriptCode,
template: templateCode,
},
});
</script>
<style lang="scss" scoped></style>