adminforth 2.17.0-next.3 → 2.17.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -322,7 +322,7 @@ async function searchOptions(columnName: string, searchTerm: string) {
|
|
|
322
322
|
|
|
323
323
|
|
|
324
324
|
const editableColumns = computed(() => {
|
|
325
|
-
return props.resource?.columns?.filter(column => column.showIn?.[mode.value] && (currentValues.value ? checkShowIf(column, currentValues.value) : true));
|
|
325
|
+
return props.resource?.columns?.filter(column => column.showIn?.[mode.value] && (currentValues.value ? checkShowIf(column, currentValues.value, props.resource.columns) : true));
|
|
326
326
|
});
|
|
327
327
|
|
|
328
328
|
const isValid = computed(() => {
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
dark:bg-darkShowTablesBodyBackground dark:border-darkShowTableBodyBorder block md:table-row"
|
|
25
25
|
>
|
|
26
26
|
<component
|
|
27
|
-
v-if="column.components?.showRow && checkShowIf(column, record)"
|
|
27
|
+
v-if="column.components?.showRow && checkShowIf(column, record, resource?.columns || [])"
|
|
28
28
|
:is="getCustomComponent(column.components.showRow)"
|
|
29
29
|
:meta="column.components.showRow.meta"
|
|
30
30
|
:column="column"
|
|
31
31
|
:resource="coreStore.resource"
|
|
32
32
|
:record="coreStore.record"
|
|
33
33
|
/>
|
|
34
|
-
<template v-else-if="checkShowIf(column, record)">
|
|
34
|
+
<template v-else-if="checkShowIf(column, record, resource?.columns || [])">
|
|
35
35
|
<td class="px-6 py-4 relative block md:table-cell font-bold md:font-normal pb-0 md:pb-4">
|
|
36
36
|
{{ column.label }}
|
|
37
37
|
</td>
|
package/dist/spa/src/utils.ts
CHANGED
|
@@ -446,9 +446,13 @@ export function createSearchInputHandlers(
|
|
|
446
446
|
}, {} as Record<string, (searchTerm: string) => void>);
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
-
export function checkShowIf(c: AdminForthResourceColumnInputCommon, record: Record<string, any
|
|
449
|
+
export function checkShowIf(c: AdminForthResourceColumnInputCommon, record: Record<string, any>, allColumns: AdminForthResourceColumnInputCommon[]) {
|
|
450
450
|
if (!c.showIf) return true;
|
|
451
|
-
|
|
451
|
+
for (const col of allColumns) {
|
|
452
|
+
if (!record[col.name]) {
|
|
453
|
+
record[col.name] = null;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
452
456
|
const evaluatePredicate = (predicate: Predicate): boolean => {
|
|
453
457
|
const results: boolean[] = [];
|
|
454
458
|
|
|
@@ -192,7 +192,7 @@ async function saveRecord(opts?: { confirmationResult?: any }) {
|
|
|
192
192
|
validating.value = false;
|
|
193
193
|
}
|
|
194
194
|
const requiredColumns = coreStore.resource?.columns.filter(c => c.required?.create === true) || [];
|
|
195
|
-
const requiredColumnsToSkip = requiredColumns.filter(c => checkShowIf(c, record.value) === false);
|
|
195
|
+
const requiredColumnsToSkip = requiredColumns.filter(c => checkShowIf(c, record.value, coreStore.resource?.columns || []) === false);
|
|
196
196
|
saving.value = true;
|
|
197
197
|
const response = await callAdminForthApi({
|
|
198
198
|
method: 'POST',
|