Fixed #7052 - 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

View File

@ -104,14 +104,17 @@ export default {
return isNotEmpty(this.d_value); return isNotEmpty(this.d_value);
}, },
$invalid() { $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() { $formName() {
return this.name || this.$formControl?.name; return !this.$formNovalidate ? this.name || this.$formControl?.name : undefined;
}, },
$formControl() { $formControl() {
return this.formControl || this.$pcFormField?.formControl; return this.formControl || this.$pcFormField?.formControl;
}, },
$formNovalidate() {
return this.$formControl?.novalidate;
},
$formDefaultValue() { $formDefaultValue() {
return this.findNonEmpty(this.d_value, this.$pcFormField?.initialValue, this.$pcForm?.initialValues?.[this.$formName]); 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 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) => { const onSubmit = $form.handleSubmit((e) => {

View File

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

View File

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