Skip to content

Commit de9a026

Browse files
author
Kevin Szymura
committed
feat: use handle blur correct
1 parent 45dc148 commit de9a026

20 files changed

+82
-13
lines changed

src/components/PrimeAutoComplete.vue

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ function handleInput(e: any) {
2222
context?.node.input(props.context?._value)
2323
}
2424
25+
const handleBlur = (event: Event) => {
26+
context?.handlers.blur(event);
27+
}
28+
2529
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
2630
</script>
2731

@@ -37,6 +41,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
3741
:suggestions="suggestions"
3842
@complete="search"
3943
@change="handleInput"
44+
@blur="handleBlur"
4045
/>
4146
</div>
4247
</template>

src/components/PrimeCheckbox.vue

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ function handleInput(e: any) {
1616
context?.node.input(props.context?._value)
1717
}
1818
19+
function handleBlur(e: Event) {
20+
context?.handlers.blur(e)
21+
}
22+
1923
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
2024
</script>
2125

@@ -32,6 +36,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
3236
:input-class="styleClass"
3337
:binary="attrs.binary ?? true"
3438
@change="handleInput"
39+
@blur="handleBlur"
3540
/>
3641
<span v-if="context.attrs.labelRight" class="formkit-prime-right">{{ context.attrs.labelRight }}</span>
3742
</div>

src/components/PrimeInputMask.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ const props = defineProps({
1212
const context = props.context
1313
const attrs = computed(() => context?.attrs)
1414
15-
function handleInput(e: any) {
15+
function handleInput(e: Event) {
1616
context?.node.input(props.context?._value)
17-
context?.handlers.blur(props.context?._value)
17+
context?.handlers.blur(e)
1818
}
1919
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
2020
</script>

src/components/PrimeInputSwitch.vue

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ const attrs = computed(() => context?.attrs)
1515
function handleInput(e: any) {
1616
context?.node.input(props.context?._value)
1717
}
18+
19+
function handleBlur(e: Event) {
20+
context?.handlers.blur(e)
21+
}
22+
1823
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
1924
</script>
2025

@@ -30,6 +35,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
3035
:input-style="attrs.style"
3136
:input-class="styleClass"
3237
@change="handleInput"
38+
@blur='handleBlur'
3339
/>
3440
<span v-if="context.attrs.labelRight" class="formkit-prime-right">{{ context.attrs.labelRight }}</span>
3541
</div>

src/components/PrimeListbox.vue

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ function handleInput(e: any) {
1616
context?.node.input(props.context?._value)
1717
}
1818
19+
function handleBlur(e: Event) {
20+
context?.handlers.blur(e)
21+
}
22+
1923
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
2024
</script>
2125

@@ -30,6 +34,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
3034
:class="styleClass"
3135
:unstyled="attrs.unstyled ?? false"
3236
@change="handleInput"
37+
@blur="handleBlur"
3338
/>
3439
</div>
3540
</template>

src/components/PrimePassword.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const props = defineProps({
1212
const context = props.context
1313
const attrs = computed(() => context?.attrs)
1414
15-
function handleBlur(e: any) {
16-
context?.handlers.blur(e.target.value)
15+
function handleBlur(e: Event) {
16+
context?.handlers.blur(e)
1717
}
1818
1919
function handleInput(e: any) {

src/components/PrimeRadioButton.vue

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ function handleChange(e: any) {
1616
context?.node.input(props.context?._value)
1717
}
1818
19+
function handleBlur(e: Event) {
20+
context?.handlers.blur(e)
21+
}
22+
1923
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
2024
</script>
2125

@@ -33,6 +37,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
3337
:input-class="styleClass"
3438
@click="handleChange"
3539
@change="handleChange"
40+
@blur="handleChange"
3641
/>
3742
<label :for="option.value">{{ option.label }}</label>
3843
</div>

src/components/PrimeRating.vue

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ function handleInput(e: any) {
1616
context?.node.input(props.context?._value)
1717
}
1818
19+
function handleBlur(e: Event) {
20+
context?.handlers.blur(e)
21+
}
22+
1923
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
2024
</script>
2125

@@ -32,6 +36,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
3236
:off-icon="attrs.offIcon ?? 'pi pi-star'"
3337
:cancel="attrs.cancel ?? false"
3438
@change="handleInput"
39+
@blur="handleBlur"
3540
/>
3641
</div>
3742
</template>

src/components/PrimeSelectButton.vue

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ function handleChange(e: any) {
1616
context?.node.input(props.context?._value)
1717
}
1818
19+
function handleBlur(e: Event) {
20+
context?.handlers.blur(e)
21+
}
22+
1923
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
2024
</script>
2125

@@ -29,6 +33,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
2933
:style="attrs.style"
3034
:class="styleClass"
3135
@change="handleChange"
36+
@blur="handleBlur"
3237
/>
3338
</div>
3439
</template>

src/components/PrimeSlider.vue

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ function handleInput(e: any) {
1616
context?.node.input(e)
1717
context?.handlers.blur(e)
1818
}
19+
20+
function handleBlur(e: Event) {
21+
context?.handlers.blur(e)
22+
}
23+
1924
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
2025
</script>
2126

@@ -29,6 +34,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
2934
:style="attrs.style"
3035
:class="styleClass"
3136
@change="handleInput"
37+
@blur="handleBlur"
3238
/>
3339
</div>
3440
</template>

src/components/PrimeTextarea.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const props = defineProps({
1212
const context = props.context
1313
const attrs = computed(() => context?.attrs)
1414
15-
function handleBlur(e: any) {
16-
context?.handlers.blur(e.target.value)
15+
function handleBlur(e: Event) {
16+
context?.handlers.blur(e)
1717
}
1818
1919
function handleInput(e: any) {

src/components/PrimeToggleButton.vue

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ const attrs = computed(() => context?.attrs)
1515
function handleChange(e: any) {
1616
context?.node.input(props.context?._value)
1717
}
18+
19+
function handleBlur(e: Event) {
20+
context?.handlers.blur(e)
21+
}
22+
1823
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
1924
</script>
2025

@@ -31,6 +36,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
3136
:on-icon="context.onIcon ?? 'pi pi-check'"
3237
:off-icon="context.offIcon ?? 'pi pi-times'"
3338
@change="handleChange"
39+
@blur="handleBlur"
3440
/>
3541
</div>
3642
</template>

src/components/PrimeTreeSelect.vue

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ function handleInput(e: any) {
1616
context?.node.input(props.context?._value)
1717
}
1818
19+
function handleBlur(e: Event) {
20+
context?.handlers.blur(e)
21+
}
22+
1923
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
2024
</script>
2125

@@ -30,6 +34,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
3034
:input-style="attrs.style"
3135
:input-class="styleClass"
3236
@change="handleInput"
37+
@blur="handleBlur"
3338
/>
3439
</div>
3540
</template>

src/components/PrimeTriStateCheckbox.vue

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ function handleChange(e: any) {
1616
context?.node.input(props.context?._value)
1717
}
1818
19+
function handleBlur(e: Event) {
20+
context?.handlers.blur(e)
21+
}
22+
1923
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
2024
</script>
2125

@@ -31,6 +35,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
3135
:input-style="attrs.style"
3236
:input-class="styleClass"
3337
@change="handleChange"
38+
@blur="handleBlur"
3439
/>
3540
<span v-if="context.attrs.labelRight" class="formkit-prime-right">{{ context.attrs.labelRight }}</span>
3641
</div>

src/formkit/PrimeCalendar.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function handleSelect(e: any) {
2222
}
2323
2424
function handleBlur(e: CalendarBlurEvent) {
25-
context?.handlers.blur(e.value)
25+
context?.handlers.blur(e.originalEvent)
2626
}
2727
2828
function handleClearClick() {

src/formkit/PrimeDropdown.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const props = defineProps({
1212
const context = props.context
1313
const attrs = computed(() => context?.attrs)
1414
15-
function handleBlur(e: any) {
16-
context?.handlers.blur(e.value)
15+
function handleBlur(e: Event) {
16+
context?.handlers.blur(e)
1717
}
1818
function handleInput(e: any) {
1919
context?.node.input(e.value)

src/formkit/PrimeInputNumber.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang='ts'>
22
import { type PropType, computed } from 'vue';
33
import { type FormKitFrameworkContext } from '@formkit/core';
4+
import { InputNumberBlurEvent } from 'primevue/inputnumber'
45
56
const props = defineProps({
67
context: {
@@ -12,8 +13,8 @@ const props = defineProps({
1213
const context = props.context
1314
const attrs = computed(() => context?.attrs)
1415
15-
function handleBlur(e: any) {
16-
context?.handlers.blur(e.value)
16+
function handleBlur(e: InputNumberBlurEvent) {
17+
context?.handlers.blur(e.originalEvent)
1718
}
1819
1920
function handleInput(e: any) {

src/formkit/PrimeInputText.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ function spanClass() {
2929
return result
3030
}
3131
32-
function handleBlur(e: any) {
33-
context?.handlers.blur(e.target.value)
32+
function handleBlur(e: Event) {
33+
context?.handlers.blur(e)
3434
}
3535
3636
function handleInput(e: any) {

src/formkit/PrimeListbox.vue

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ function handleInput(e: any) {
1616
context?.node.input(props.context?._value)
1717
}
1818
19+
function handleBlur(e: Event) {
20+
context?.handlers.blur(e)
21+
}
22+
1923
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
2024
</script>
2125

@@ -46,6 +50,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
4650
:pt-options="attrs.ptOptions"
4751
:unstyled="attrs.unstyled ?? false"
4852
@change="handleInput"
53+
@blur='handleBlur'
4954
/>
5055
</div>
5156
</template>

src/formkit/PrimeMultiSelect.vue

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ function handleChange(e: any) {
1616
context?.node.input(props.context?._value)
1717
}
1818
19+
function handleBlur(e: Event) {
20+
context?.handlers.blur(e)
21+
}
22+
1923
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
2024
</script>
2125

@@ -68,6 +72,7 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
6872
:pt-options="attrs.ptOptions"
6973
:unstyled="attrs.unstyled ?? false"
7074
@change="handleChange"
75+
@blur="handleBlur"
7176
/>
7277
</div>
7378
</template>

0 commit comments

Comments
 (0)