Fixed - Select filter in forms (FormField): The filter input is also invalid when select is invalid.

pull/7064/merge
Mert Sincan 2025-01-13 10:05:37 +00:00
parent 8336423981
commit c1f3bdaf72
4 changed files with 23 additions and 5 deletions
packages
core/src/baseeditableholder
forms/src/form
primevue/src
multiselect

View File

@ -104,14 +104,17 @@ export default {
return isNotEmpty(this.d_value);
},
$invalid() {
return this.findNonEmpty(this.invalid, this.$pcFormField?.$field?.invalid, this.$pcForm?.getFieldState(this.$formName)?.invalid);
return !this.$formNovalidate && this.findNonEmpty(this.invalid, this.$pcFormField?.$field?.invalid, this.$pcForm?.getFieldState(this.$formName)?.invalid);
},
$formName() {
return this.name || this.$formControl?.name;
return !this.$formNovalidate ? this.name || this.$formControl?.name : undefined;
},
$formControl() {
return this.formControl || this.$pcFormField?.formControl;
},
$formNovalidate() {
return this.$formControl?.novalidate;
},
$formDefaultValue() {
return this.findNonEmpty(this.d_value, this.$pcFormField?.initialValue, this.$pcForm?.initialValues?.[this.$formName]);
},

View File

@ -24,9 +24,13 @@ export default {
};
const register = (field, options) => {
const [, fieldProps] = $form.defineField(field, options);
if (!options?.novalidate) {
const [, fieldProps] = $form.defineField(field, options);
return fieldProps;
return fieldProps;
}
return {};
};
const onSubmit = $form.handleSubmit((e) => {

View File

@ -88,6 +88,7 @@
@change="onToggleAll"
:unstyled="unstyled"
:pt="getHeaderCheckboxPTOptions('pcHeaderCheckbox')"
:formControl="{ novalidate: true }"
>
<template #icon="slotProps">
<component v-if="$slots.headercheckboxicon" :is="$slots.headercheckboxicon" :checked="slotProps.checked" :class="slotProps.class" />
@ -113,6 +114,7 @@
@blur="onFilterBlur"
@input="onFilterChange"
:pt="ptm('pcFilter')"
:formControl="{ novalidate: true }"
/>
<InputIcon :unstyled="unstyled" :pt="ptm('pcFilterIconContainer')">
<slot name="filtericon">
@ -159,7 +161,15 @@
:data-p-focused="focusedOptionIndex === getOptionIndex(i, getItemOptions)"
:data-p-disabled="isOptionDisabled(option)"
>
<Checkbox :defaultValue="isSelected(option)" :binary="true" :tabindex="-1" :variant="variant" :unstyled="unstyled" :pt="getCheckboxPTOptions(option, getItemOptions, i, 'pcOptionCheckbox')">
<Checkbox
:defaultValue="isSelected(option)"
:binary="true"
:tabindex="-1"
:variant="variant"
:unstyled="unstyled"
:pt="getCheckboxPTOptions(option, getItemOptions, i, 'pcOptionCheckbox')"
:formControl="{ novalidate: true }"
>
<template #icon="slotProps">
<component v-if="$slots.optioncheckboxicon || $slots.itemcheckboxicon" :is="$slots.optioncheckboxicon || $slots.itemcheckboxicon" :checked="slotProps.checked" :class="slotProps.class" />
<component

View File

@ -96,6 +96,7 @@
@blur="onFilterBlur"
@input="onFilterChange"
:pt="ptm('pcFilter')"
:formControl="{ novalidate: true }"
/>
<InputIcon :unstyled="unstyled" :pt="ptm('pcFilterIconContainer')">
<slot name="filtericon">