Skip to content

Commit aff3811

Browse files
committed
feature(validation): use PrimeVue invalid property for validation
fixes #51
1 parent fd823aa commit aff3811

23 files changed

+72
-47
lines changed

src/components/PrimeAutoComplete.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const props = defineProps({
2121
},
2222
})
2323
24-
const { styleClass, handleInput, handleBlur } = useFormKitInput(props.context)
24+
const { isInvalid, handleInput, handleBlur } = useFormKitInput(props.context)
2525
2626
const suggestions = ref([])
2727
@@ -37,7 +37,8 @@ function search(event: AutoCompleteCompleteEvent) {
3737
v-model="context._value"
3838
v-bind="context?.attrs"
3939
:disabled="!!context?.disabled"
40-
:class="styleClass"
40+
:class="context?.attrs?.class"
41+
:invalid="isInvalid"
4142
:tabindex="context?.attrs.tabindex"
4243
:aria-label="context?.attrs.ariaLabel"
4344
:aria-labelledby="context?.attrs.ariaLabelledby"

src/components/PrimeCascadeSelect.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const props = defineProps({
2525
},
2626
})
2727
28-
const { styleClass, handleInput, handleBlur } = useFormKitInput(props.context)
28+
const { isInvalid, handleInput, handleBlur } = useFormKitInput(props.context)
2929
</script>
3030

3131
<template>
@@ -36,7 +36,8 @@ const { styleClass, handleInput, handleBlur } = useFormKitInput(props.context)
3636
v-bind="context?.attrs"
3737
:disabled="!!context?.disabled"
3838
:readonly="context?.attrs.readonly ?? false"
39-
:class="styleClass"
39+
:class="context?.attrs?.class"
40+
:invalid="isInvalid"
4041
:tabindex="context?.attrs.tabindex"
4142
:aria-label="context?.attrs.ariaLabel"
4243
:aria-labelledby="context?.attrs.ariaLabelledby"

src/components/PrimeCheckbox.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const props = defineProps({
2525
2626
const { hasPrefix, hasSuffix, generateId } = useFormKitSection(props.context)
2727
28-
const { styleClass, handleInput, handleBlur } = useFormKitInput(props.context)
28+
const { isInvalid, handleInput, handleBlur } = useFormKitInput(props.context)
2929
3030
const generatedId = generateId()
3131
</script>
@@ -42,7 +42,8 @@ const generatedId = generateId()
4242
:disabled="!!context?.disabled"
4343
:readonly="context?.attrs.readonly ?? false"
4444
:input-style="context?.attrs.style"
45-
:input-class="styleClass"
45+
:input-class="context?.attrs?.class"
46+
:invalid="isInvalid"
4647
:tabindex="context?.attrs.tabindex"
4748
:aria-label="context?.attrs.ariaLabel"
4849
:aria-labelledby="context?.attrs.ariaLabelledby"

src/components/PrimeDatePicker.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const props = defineProps({
5959
},
6060
})
6161
62-
const { styleClass, handleInput, handleSelect } = useFormKitInput(props.context)
62+
const { isInvalid, handleInput, handleSelect } = useFormKitInput(props.context)
6363
6464
function handleBlur(e: DatePickerBlurEvent) {
6565
props.context?.handlers.blur(e.originalEvent)
@@ -79,7 +79,8 @@ function handleClearClick() {
7979
:disabled="!!context?.disabled"
8080
:readonly="context?.attrs.readonly ?? false"
8181
:input-style="context?.attrs.style"
82-
:input-class="styleClass"
82+
:input-class="context?.attrs?.class"
83+
:invalid="isInvalid"
8384
:tabindex="context?.attrs.tabindex"
8485
:aria-label="context?.attrs.ariaLabel"
8586
:aria-labelledby="context?.attrs.ariaLabelledby"

src/components/PrimeEditor.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const props = defineProps({
2222
},
2323
})
2424
25-
const { styleClass, handleInput } = useFormKitInput(props.context)
25+
const { isInvalid, handleInput } = useFormKitInput(props.context)
2626
2727
function handleSelection(e: EditorSelectionChangeEvent) {
2828
if (e.range === null)
@@ -39,7 +39,8 @@ function handleSelection(e: EditorSelectionChangeEvent) {
3939
:disabled="!!context?.disabled"
4040
:readonly="context?.attrs.readonly ?? false"
4141
:editor-style="context?.attrs.style"
42-
:class="styleClass"
42+
:class="context?.attrs?.class"
43+
:invalid="isInvalid"
4344
:tabindex="context?.attrs.tabindex"
4445
:aria-label="context?.attrs.ariaLabel"
4546
:aria-labelledby="context?.attrs.ariaLabelledby"

src/components/PrimeInputMask.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const props = defineProps({
2626
},
2727
})
2828
29-
const { styleClass, handleInput, handleBlur } = useFormKitInput(props.context)
29+
const { isInvalid, handleInput, handleBlur } = useFormKitInput(props.context)
3030
const { hasPrefixIcon, hasSuffixIcon } = useFormKitSection(props.context)
3131
</script>
3232

@@ -40,7 +40,8 @@ const { hasPrefixIcon, hasSuffixIcon } = useFormKitSection(props.context)
4040
v-bind="context?.attrs"
4141
:disabled="!!context?.disabled"
4242
:readonly="context?.attrs.readonly ?? false"
43-
:class="styleClass"
43+
:class="context?.attrs?.class"
44+
:invalid="isInvalid"
4445
:tabindex="context?.attrs.tabindex"
4546
:aria-label="context?.attrs.ariaLabel"
4647
:aria-labelledby="context?.attrs.ariaLabelledby"
@@ -49,7 +50,6 @@ const { hasPrefixIcon, hasSuffixIcon } = useFormKitSection(props.context)
4950
:auto-clear="context.autoClear ?? true"
5051
:unmask="context.unmask ?? false"
5152
:pt="context.pt"
52-
:invalid="context.invalid"
5353
:variant="context.variant"
5454
:pt-options="context.ptOptions"
5555
:unstyled="context.unstyled ?? false"

src/components/PrimeInputNumber.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const props = defineProps({
3333
},
3434
})
3535
36-
const { styleClass, handleInput } = useFormKitInput(props.context)
36+
const { isInvalid, handleInput } = useFormKitInput(props.context)
3737
3838
function handleBlur(e: InputNumberBlurEvent) {
3939
props.context?.handlers.blur(e.originalEvent)
@@ -49,7 +49,8 @@ function handleBlur(e: InputNumberBlurEvent) {
4949
:disabled="!!context?.disabled"
5050
:readonly="context?.attrs.readonly ?? false"
5151
:input-style="context?.attrs.style"
52-
:input-class="styleClass"
52+
:input-class="context?.attrs?.class"
53+
:invalid="isInvalid"
5354
:tabindex="context?.attrs.tabindex"
5455
:aria-label="context?.attrs.ariaLabel"
5556
:aria-labelledby="context?.attrs.ariaLabelledby"

src/components/PrimeInputOtp.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const props = defineProps({
2323
},
2424
})
2525
26-
const { styleClass, handleBlur, handleInput } = useFormKitInput(props.context)
26+
const { isInvalid, handleBlur, handleInput } = useFormKitInput(props.context)
2727
</script>
2828

2929
<template>
@@ -35,7 +35,8 @@ const { styleClass, handleBlur, handleInput } = useFormKitInput(props.context)
3535
:disabled="!!context?.disabled"
3636
:readonly="context?.attrs.readonly ?? false"
3737
:style="context?.attrs.style"
38-
:class="styleClass"
38+
:class="context?.attrs?.class"
39+
:invalid="isInvalid"
3940
:tabindex="context?.attrs.tabindex"
4041
:aria-label="context?.attrs.ariaLabel"
4142
:aria-labelledby="context?.attrs.ariaLabelledby"

src/components/PrimeInputText.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const props = defineProps({
2121
},
2222
})
2323
24-
const { styleClass, handleInput, handleBlur } = useFormKitInput(props.context)
24+
const { isInvalid, handleInput, handleBlur } = useFormKitInput(props.context)
2525
const { hasPrefixIcon, hasSuffixIcon } = useFormKitSection(props.context)
2626
</script>
2727

@@ -36,7 +36,8 @@ const { hasPrefixIcon, hasSuffixIcon } = useFormKitSection(props.context)
3636
:disabled="!!context?.disabled"
3737
:readonly="context?.attrs.readonly ?? false"
3838
:style="context?.attrs.style"
39-
:class="styleClass"
39+
:class="context?.attrs?.class"
40+
:invalid="isInvalid"
4041
:tabindex="context?.attrs.tabindex"
4142
:aria-label="context?.attrs.ariaLabel"
4243
:aria-labelledby="context?.attrs.ariaLabelledby"

src/components/PrimeKnob.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const props = defineProps({
2929
},
3030
})
3131
32-
const { styleClass } = useFormKitInput(props.context)
32+
const { isInvalid } = useFormKitInput(props.context)
3333
3434
function handleInput(e: any) {
3535
props.context?.node.input(e)
@@ -50,7 +50,8 @@ function updateValue(n: number) {
5050
:disabled="!!context?.disabled"
5151
:readonly="context?.attrs.readonly ?? false"
5252
:style="context?.attrs.style"
53-
:class="styleClass"
53+
:class="context?.attrs?.class"
54+
:invalid="isInvalid"
5455
:tabindex="context?.attrs.tabindex"
5556
:aria-label="context?.attrs.ariaLabel"
5657
:aria-labelledby="context?.attrs.ariaLabelledby"

0 commit comments

Comments
 (0)