Skip to content

Commit ea59fde

Browse files
authored
Merge pull request #101 from devforth/refactor-custom-valid-emptiness
refactor: change custom components state emits handling
2 parents 9d535fd + b2e0b13 commit ea59fde

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

adminforth/spa/src/components/ResourceForm.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
:validating="validating"
1616
:columnError="columnError"
1717
:setCurrentValue="setCurrentValue"
18-
@update:customComponentsInValidity="(data) => customComponentsInValidity.value = { ...customComponentsInValidity.value, ...data }"
19-
@update:customComponentsEmptiness="(data) => customComponentsEmptiness.value = { ...customComponentsEmptiness.value, ...data }"
18+
@update:customComponentsInValidity="(data) => customComponentsInValidity = { ...customComponentsInValidity, ...data }"
19+
@update:customComponentsEmptiness="(data) => customComponentsEmptiness = { ...customComponentsEmptiness, ...data }"
2020
/>
2121
</div>
2222
<div v-else class="flex flex-col gap-4">
@@ -32,8 +32,8 @@
3232
:validating="validating"
3333
:columnError="columnError"
3434
:setCurrentValue="setCurrentValue"
35-
@update:customComponentsInValidity="(data) => customComponentsInValidity.value = { ...customComponentsInValidity.value, ...data }"
36-
@update:customComponentsEmptiness="(data) => customComponentsEmptiness.value = { ...customComponentsEmptiness.value, ...data }"
35+
@update:customComponentsInValidity="(data) => customComponentsInValidity = { ...customComponentsInValidity, ...data }"
36+
@update:customComponentsEmptiness="(data) => customComponentsEmptiness = { ...customComponentsEmptiness, ...data }"
3737
/>
3838
</template>
3939
<div v-if="otherColumns.length > 0">
@@ -48,8 +48,8 @@
4848
:validating="validating"
4949
:columnError="columnError"
5050
:setCurrentValue="setCurrentValue"
51-
@update:customComponentsInValidity="(data) => customComponentsInValidity.value = { ...customComponentsInValidity.value, ...data }"
52-
@update:customComponentsEmptiness="(data) => customComponentsEmptiness.value = { ...customComponentsEmptiness.value, ...data }"
51+
@update:customComponentsInValidity="(data) => customComponentsInValidity = { ...customComponentsInValidity, ...data }"
52+
@update:customComponentsEmptiness="(data) => customComponentsEmptiness = { ...customComponentsEmptiness, ...data }"
5353
/>
5454
</div>
5555
</div>
@@ -95,8 +95,8 @@ const columnError = (column) => {
9595
if (!currentValues.value) {
9696
return null;
9797
}
98-
if (customComponentsInValidity.value?.value?.[column.name]) {
99-
return customComponentsInValidity.value?.value?.[column.name];
98+
if (customComponentsInValidity.value?.[column.name]) {
99+
return customComponentsInValidity.value?.[column.name];
100100
}
101101
102102
if ( column.required[mode.value] ) {
@@ -105,7 +105,7 @@ const columnError = (column) => {
105105
currentValues.value[column.name] === '' ||
106106
(column.isArray?.enabled && !currentValues.value[column.name].length);
107107
108-
const emitedEmptiness = customComponentsEmptiness.value?.value?.[column.name];
108+
const emitedEmptiness = customComponentsEmptiness.value?.[column.name];
109109
// if component is custum it might tell other criteria for emptiness by emitting 'update:emptiness'
110110
// components which do not emit 'update:emptiness' will have undefined value in customComponentsEmptiness
111111
let actualEmptiness;

0 commit comments

Comments
 (0)