feat: Improve Contact list (#10522)

This commit is contained in:
Sivin Varghese
2024-12-02 18:23:41 -08:00
committed by GitHub
parent 86bd339a47
commit 062587487a
6 changed files with 66 additions and 40 deletions
@@ -214,6 +214,10 @@ const resetValidation = () => {
v$.value.$reset();
};
const resetForm = () => {
Object.assign(state, defaultState);
};
watch(() => props.contactData, prepareStateBasedOnProps, {
immediate: true,
deep: true,
@@ -224,6 +228,7 @@ defineExpose({
state,
resetValidation,
isFormInvalid,
resetForm,
});
</script>
@@ -261,7 +266,7 @@ defineExpose({
:placeholder="item.placeholder"
:message-type="getMessageType(item.key)"
:custom-input-class="`h-8 !pt-1 !pb-1 ${
!isDetailsView ? '[&:not(.error)]:!border-transparent' : ''
!isDetailsView ? '[&:not(.error,.focus)]:!border-transparent' : ''
}`"
class="w-full"
@input="
@@ -27,11 +27,16 @@ const handleDialogConfirm = async () => {
emit('create', contact.value);
};
const onSuccess = () => {
contactsFormRef.value?.resetForm();
dialogRef.value.close();
};
const closeDialog = () => {
dialogRef.value.close();
};
defineExpose({ dialogRef, contactsFormRef });
defineExpose({ dialogRef, contactsFormRef, onSuccess });
</script>
<template>