-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(primevue-nuxt): use official primevue nuxt module
- Loading branch information
Showing
7 changed files
with
1,340 additions
and
1,219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ref } from 'vue' | ||
|
||
export function usePrimeDataTable () { | ||
const tableData = ref([]) | ||
|
||
const filters = ref({}) | ||
const dataTableRef = ref() | ||
|
||
function exportCSV () { | ||
dataTableRef.value?.exportCSV() | ||
} | ||
|
||
return { | ||
tableData, filters, dataTableRef, exportCSV | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,137 @@ | ||
<script setup lang='ts'> | ||
import { FormKitSchema } from '@formkit/vue' | ||
import { ref, reactive } from 'vue' | ||
const options = [ | ||
{ label: 'Every page load', value: 'refresh' }, | ||
{ label: 'Ever hour', value: 'hourly' }, | ||
{ label: 'Every day', value: 'daily' } | ||
] | ||
const schema = reactive( | ||
[ | ||
{ | ||
$el: 'h2', | ||
children: ['Validation with FormKit'] | ||
}, | ||
{ | ||
$el: 'h3', | ||
children: ['Inputs from PrimeVue'] | ||
}, | ||
{ | ||
$formkit: 'primeInputText', | ||
name: 'email', | ||
label: 'Email', | ||
help: 'This will be used for your account.', | ||
validation: 'required|email' | ||
}, | ||
{ | ||
$formkit: 'primeTextarea', | ||
name: 'myText', | ||
label: 'Text', | ||
rows: '5' | ||
}, | ||
{ | ||
$formkit: 'primeCalendar', | ||
name: 'myCalendar', | ||
label: 'Calendar', | ||
validation: '', | ||
showIcon: true | ||
}, | ||
{ | ||
$formkit: 'primeInputText', | ||
name: 'password', | ||
label: 'Password', | ||
help: 'Enter your new password.', | ||
validation: 'required|length:5,16' | ||
}, | ||
{ | ||
$formkit: 'primePassword', | ||
name: 'password_confirm', | ||
label: 'Confirm password', | ||
toggleMask: true, | ||
feedback: false, | ||
help: 'Enter your new password again to confirm it.', | ||
validation: 'required|confirm', | ||
validationLabel: 'password confirmation' | ||
}, | ||
{ | ||
$formkit: 'primeCheckbox', | ||
name: 'eu_citizen', | ||
id: 'eu', | ||
label: 'Are you a european citizen?' | ||
}, | ||
{ | ||
$formkit: 'primeDropdown', | ||
if: '$eu_citizen', // 👀 Oooo, conditionals! | ||
name: 'cookie_notice', | ||
label: 'Cookie notice frequency', | ||
value: 'hourly', | ||
showClear: false, | ||
filter: false, | ||
options, | ||
help: 'How often should we display a cookie notice?', | ||
class: 'test' | ||
}, | ||
{ | ||
$formkit: 'primeSlider', | ||
name: 'slider', | ||
label: 'Max messages', | ||
style: 'width: 200px;margin-top: 6px;margin-bottom: 4px', | ||
min: 5, | ||
step: 5, | ||
value: 10 | ||
}, | ||
{ | ||
$formkit: 'primeChips', | ||
name: 'chips', | ||
label: 'Use Chips' | ||
}, | ||
{ | ||
$formkit: 'primeKnob', | ||
name: 'knob', | ||
label: 'Use Knob', | ||
value: 50 | ||
} | ||
] | ||
) | ||
const data = ref({}) | ||
const submitHandler = async () => { | ||
// Lets pretend this is an ajax request: | ||
await new Promise(resolve => setTimeout(resolve, 1000)) | ||
} | ||
</script> | ||
<template> | ||
<div> | ||
<div class="card"> | ||
<div class="max-w-xl"> | ||
<PrimeDemoForm /> | ||
<div class="card flex flex-wrap gap-12"> | ||
<div class="basis-1/2 md:basis-1/3"> | ||
<span class="" /> | ||
<div class="myFormkit"> | ||
<FormKit | ||
id="form" | ||
v-model="data" | ||
type="form" | ||
:submit-attrs="{ | ||
inputClass: 'p-button p-component', | ||
wrapperClass: '', | ||
outerClass: '' | ||
}" | ||
@submit="submitHandler" | ||
> | ||
<FormKitSchema :schema="schema" :data="data" /> | ||
</FormKit> | ||
</div> | ||
</div> | ||
<div class="basis-1/2 md:basis-1/3"> | ||
<h2>Formkit Debug</h2> | ||
<h3>Data</h3> | ||
<pre>{{ data }}</pre> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang='ts'> | ||
</script> | ||
<style scoped></style> |
Oops, something went wrong.