Skip to content

Commit 25eaecd

Browse files
authored
Merge pull request #76 from HenryJobst/main
primeAutoComplete: Fix custom input props declaration and add demo for an async complete function
2 parents 55857df + d33735b commit 25eaecd

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

dev/pages/inputs/AutoComplete.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<script setup lang='ts'>
2-
const primeAttributes = 'placeholder, separator, allowDuplicate, max, addOnBlur'
2+
const primeAttributes = 'placeholder, multiple, typeahead, optionLabel, size, minLength, fluid'
33
44
const list = ['Hello', 'Hero', 'House', 'World']
55
66
function search(query: string) {
77
return [...list.filter(i => i.toLowerCase().includes(query.toLowerCase())), query]
88
}
99
10+
async function asyncSearch(query: string) {
11+
await new Promise(resolve => setTimeout(resolve, 1000))
12+
return [...list.filter(i => i.toLowerCase().includes(query.toLowerCase())), query]
13+
}
14+
1015
const userList = [
1116
{ id: '1', name: 'Tom', value: '123' },
1217
{ id: '2', name: 'Tim', value: '124' },
@@ -22,6 +27,17 @@ const schema
2227
dropdown: true,
2328
label: 'Basic AutoComplete - Use [h]ello',
2429
},
30+
{
31+
$formkit: 'primeAutoComplete',
32+
id: 'async',
33+
name: 'async',
34+
complete: asyncSearch,
35+
dropdown: true,
36+
label: 'Async AutoComplete - Use [he]llo',
37+
minLength: 2,
38+
placeholder: 'Type at least 2 characters',
39+
fluid: true,
40+
},
2541
{
2642
$formkit: 'primeAutoComplete',
2743
id: 'basic',

src/components/PrimeSelect.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export interface FormKitPrimeSelectProps {
2222
placeholder?: SelectProps['placeholder']
2323
dataKey?: SelectProps['dataKey']
2424
showClear?: SelectProps['showClear']
25-
panelStyle?: SelectProps['panelStyle']
26-
panelClass?: SelectProps['panelClass']
25+
overlayStyle?: SelectProps['overlayStyle']
26+
overlayClass?: SelectProps['overlayClass']
2727
appendTo?: SelectProps['appendTo']
2828
resetFilterOnHide?: SelectProps['resetFilterOnHide']
2929
virtualScrollerOptions?: SelectProps['virtualScrollerOptions']
@@ -86,8 +86,8 @@ const { validSlotNames, unstyled, isInvalid, handleInput, handleBlur } = useForm
8686
:placeholder="context.placeholder"
8787
:data-key="context.dataKey"
8888
:show-clear="context.showClear ?? false"
89-
:panel-style="context.panelStyle"
90-
:panel-class="context.panelClass"
89+
:overlay-style="context.overlayStyle"
90+
:overlay-class="context.overlayClass"
9191
:panel-props="context.panelProps"
9292
:append-to="context.appendTo"
9393
:reset-filter-on-hide="context.resetFilterOnHide"

src/definitions/input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import PrimeToggleSwitch from '../components/PrimeToggleSwitch.vue'
2626
import PrimeTreeSelect from '../components/PrimeTreeSelect.vue'
2727

2828
export const primeAutoCompleteDefinition: FormKitTypeDefinition = createInput(PrimeAutoComplete, {
29-
props: ['pt', 'ptOptions', 'unstyled', 'Select', 'multiple', 'typeahead', 'optionLabel', 'options', 'size'],
29+
props: ['pt', 'ptOptions', 'unstyled', 'Select', 'multiple', 'typeahead', 'optionLabel', 'options', 'size', 'minLength', 'placeholder', 'fluid'],
3030
})
3131
export const primeInputTextDefinition: FormKitTypeDefinition = createInput(PrimeInputText, {
3232
props: ['pt', 'ptOptions', 'unstyled', 'placeholder', 'iconPrefix', 'iconSuffix', 'size', 'inputType'],

0 commit comments

Comments
 (0)