Skip to content

Commit 63b72d8

Browse files
authored
Merge pull request #98 from devforth/invalidity
fix: correct custom component validity and emptiness watching
2 parents c48c260 + 227f9f7 commit 63b72d8

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

adminforth/spa/src/components/GroupsTable.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@
129129
arrayItemRefs.value[arrayItemRefs.value.length - 1].focus();
130130
}
131131
132-
watch(customComponentsInValidity, (newVal) => {
132+
watch(customComponentsInValidity.value, (newVal) => {
133133
emit('update:customComponentsInValidity', newVal);
134134
});
135135
136-
watch(customComponentsEmptiness, (newVal) => {
136+
watch(customComponentsEmptiness.value, (newVal) => {
137137
emit('update:customComponentsEmptiness', newVal);
138138
});
139139

adminforth/spa/src/components/ResourceForm.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,16 @@ const columnError = (column) => {
9595
if (!currentValues.value) {
9696
return null;
9797
}
98-
if (customComponentsInValidity.value[column.name]) {
99-
return customComponentsInValidity.value[column.name];
98+
if (customComponentsInValidity.value?.value?.[column.name]) {
99+
return customComponentsInValidity.value?.value?.[column.name];
100100
}
101-
101+
102102
if (
103103
column.required[mode.value] &&
104104
(currentValues.value[column.name] === undefined || currentValues.value[column.name] === null || currentValues.value[column.name] === '' || (column.isArray?.enabled && !currentValues.value[column.name].length)) &&
105105
// if component is custum it might tell other criteria for emptiness by emitting 'update:emptiness'
106106
// components which do not emit 'update:emptiness' will have undefined value in customComponentsEmptiness
107-
(customComponentsEmptiness.value[column.name] !== false)
107+
(customComponentsEmptiness.value?.value?.[column.name] !== false)
108108
109109
) {
110110
return t('This field is required');
@@ -130,6 +130,7 @@ const columnError = (column) => {
130130
return validateValue(column.type, currentValues.value[column.name], column);
131131
}
132132
133+
return null;
133134
});
134135
return val.value;
135136
};

0 commit comments

Comments
 (0)