Skip to content

Commit 06fd35a

Browse files
committed
refactor(InputEditor): update to prime 4 and add some more styling
1 parent 69e85d2 commit 06fd35a

File tree

4 files changed

+293
-267
lines changed

4 files changed

+293
-267
lines changed

dev/components/demo/PrimeSchemaEditor.vue

+19-18
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ const formData = reactive(props.data)
3030
const data = ref({})
3131
3232
async function submitHandler() {
33-
showMessage('success', 'Form Submitted', 'Input creation completed successfully ...')
33+
showMessage('success', `Form Input (${formData._dollar_formkit}) updated`, 'Input creation completed successfully ...')
3434
3535
data.value = { }
3636
schemaResultFormKey.value += 1
3737
Object.assign(formData, { ...formData, schemaResultFormKey: schemaResultFormKey.value })
3838
}
3939
4040
async function submitHandler2() {
41-
41+
showMessage('success', `Data submitted`, data.value)
4242
}
4343
4444
const schemaResult = computed(() => editorDataToSchema(formData))
@@ -61,8 +61,8 @@ function copyObject() {
6161
{{ header }}
6262
</h2>
6363
<slot />
64-
<div class="flex flex-wrap gap-8">
65-
<div class="min-w-40rem basis-1/2 md:basis-1/3">
64+
<div class="grid grid-cols-1 xl:grid-cols-2 gap-8">
65+
<div class="w-40rem basis-1/2 md:basis-1/3" mb-4>
6666
<h3>Create Formkit Input</h3>
6767
<FormKit
6868
v-model="formData"
@@ -77,28 +77,29 @@ function copyObject() {
7777
</FormKit>
7878
<pre v-if="false">{{ formSchema }}</pre>
7979
</div>
80-
<div class="">
80+
<div>
8181
<h3>Generated Formkit Input Preview</h3>
8282
<div class="mb-4">
8383
Some changes require to trigger the update of generated input
8484
</div>
8585
<div :key="schemaResultFormKey">
86-
<FormKit
87-
v-model="data"
88-
type="form"
89-
:submit-attrs="{
90-
inputClass: 'p-button p-component',
91-
}"
92-
@submit="submitHandler2"
93-
>
94-
<FormKitSchema :schema="schemaResult" :data="data" />
95-
</FormKit>
96-
<div class="mt-4 mb-4">
97-
<h3>Copy Schema to Clipboard - Supported: {{ isSupported }}</h3>
98-
<Button label="Copy as JSON" class="mr-4" @click="copyJson" /><Button label="Copy as Object" @click="copyObject" />
86+
<div class="max-w-100">
87+
<FormKit
88+
v-model="data"
89+
type="form"
90+
:submit-attrs="{
91+
inputClass: 'p-button p-component',
92+
}"
93+
@submit="submitHandler2"
94+
>
95+
<FormKitSchema :schema="schemaResult" :data="data" />
96+
</FormKit>
9997
</div>
10098
<h3>Generated Formkit Schema</h3>
10199
<pre>{{ schemaResult }}</pre>
100+
<Button v-if="isSupported" label="Copy as JSON" class="mr-4" @click="copyJson" />
101+
<Button v-if="isSupported" label="Copy as Object" @click="copyObject" />
102+
102103
<h3>Generated Formkit Data</h3>
103104
<pre>{{ data }}</pre>
104105
</div>

dev/pages/inputs/InputOtp.vue

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@ const schema
44
= [
55
{
66
$formkit: 'primeInputOtp',
7-
name: 'myInput',
7+
name: 'firstInput',
88
label: 'Input OTP',
99
length: 6,
1010
integerOnly: true,
1111
mask: true,
1212
variant: 'outlined',
1313
},
14+
{
15+
$formkit: 'primeInputOtp',
16+
name: 'secondInput',
17+
label: 'Input OTP',
18+
length: 3,
19+
},
1420
]
1521
1622
const data = { }

0 commit comments

Comments
 (0)