I’m working on customizing the system filter logic in the Directus system filter component. Specifically, I’m looking at this section of the code:
input-component.vue
— line 105, where the component performs validation and emits the value only if it’s valid.
The issue I’m facing is that for fields like "user_created"
, the current logic expects a UUID by default (since it is a relational field). So when I try to apply a filter like:
{
"user_created": {
"_contains": "smith"
}
}
it doesn’t pass validation.
However, based on some configuration, I want to override this behavior. Specifically, I want to intercept and transform the filter into a nested form like this:
{
"user_created": {
"first_name": {
"_contains": "smith"
}
}
}
To do this, I need access to both:
- The current collection being filtered
- The current field (e.g.,
"user_created"
in this case)
How can I access the current collection name and field key within input-component.vue
or higher up in system-filter.vue
so that I can apply custom validation logic based on field types or collection-specific rules?
Any guidance on the best way to inject or retrieve this contextual information would be greatly appreciated.