mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Show validation errors in drawer-item (#17423)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div ref="el" class="v-form" :class="gridClass">
|
||||
<validation-errors
|
||||
v-if="!nested && validationErrors.length > 0"
|
||||
v-if="showValidationErrors && validationErrors.length > 0"
|
||||
:validation-errors="validationErrors"
|
||||
:fields="fields ? fields : []"
|
||||
@scroll-to-field="scrollToField"
|
||||
/>
|
||||
<v-info
|
||||
v-if="noVisibleFields && !nested && !loading"
|
||||
v-if="noVisibleFields && showNoVisibleFields && !loading"
|
||||
:title="t('no_visible_fields')"
|
||||
:icon="inline ? false : 'search'"
|
||||
center
|
||||
@@ -115,7 +115,8 @@ interface Props {
|
||||
autofocus?: boolean;
|
||||
group?: string | null;
|
||||
badge?: string;
|
||||
nested?: boolean;
|
||||
showValidationErrors?: boolean;
|
||||
showNoVisibleFields?: boolean;
|
||||
rawEditorEnabled?: boolean;
|
||||
direction?: string;
|
||||
showDivider?: boolean;
|
||||
@@ -135,7 +136,8 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
autofocus: false,
|
||||
group: null,
|
||||
badge: undefined,
|
||||
nested: false,
|
||||
showValidationErrors: true,
|
||||
showNoVisibleFields: true,
|
||||
rawEditorEnabled: false,
|
||||
direction: undefined,
|
||||
showDivider: false,
|
||||
@@ -203,7 +205,7 @@ const noVisibleFields = computed(() => {
|
||||
watch(
|
||||
() => props.validationErrors,
|
||||
(newVal, oldVal) => {
|
||||
if (props.nested) return;
|
||||
if (!props.showValidationErrors) return;
|
||||
if (isEqual(newVal, oldVal)) return;
|
||||
if (newVal?.length > 0) el?.value?.scrollIntoView({ behavior: 'smooth' });
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
:batch-mode="batchMode"
|
||||
:disabled="disabled"
|
||||
:direction="direction"
|
||||
nested
|
||||
:show-no-visible-fields="false"
|
||||
:show-validation-errors="false"
|
||||
@update:model-value="$emit('apply', $event)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,8 @@
|
||||
:disabled="disabled"
|
||||
:badge="badge"
|
||||
:direction="direction"
|
||||
nested
|
||||
:show-no-visible-fields="false"
|
||||
:show-validation-errors="false"
|
||||
@update:model-value="$emit('apply', $event)"
|
||||
/>
|
||||
</v-detail>
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
:badge="badge"
|
||||
:raw-editor-enabled="rawEditorEnabled"
|
||||
:direction="direction"
|
||||
nested
|
||||
:show-no-visible-fields="false"
|
||||
:show-validation-errors="false"
|
||||
@update:model-value="$emit('apply', $event)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
v-if="junctionField"
|
||||
:disabled="disabled"
|
||||
:loading="loading"
|
||||
:nested="true"
|
||||
:show-no-visible-fields="false"
|
||||
:initial-values="initialValues?.[junctionField]"
|
||||
:primary-key="relatedPrimaryKey"
|
||||
:model-value="internalEdits?.[junctionField]"
|
||||
@@ -52,7 +52,7 @@
|
||||
v-model="internalEdits"
|
||||
:disabled="disabled"
|
||||
:loading="loading"
|
||||
:nested="true"
|
||||
:show-no-visible-fields="false"
|
||||
:initial-values="initialValues"
|
||||
:autofocus="swapFormOrder"
|
||||
:show-divider="swapFormOrder"
|
||||
|
||||
Reference in New Issue
Block a user