Add support for Conditional Fields (#6864)

* Add conditions field to directus_fields

* Add conditions configuration

* Apply conditional overrides

* Handle conditions in nested groups

* Fix reverse mutating conditions

* Start on filter setup interface

* Move field types/constants to shared

* [WIP] Updated client side filter validation

* Support logical operators in client validation step

* Use new validation util in conditions check

* Add nesting in filter seutp

* Add filter rule setup configurator

* Fixes that should've been done in the merge

* Strip out filter-settings interface

TBD in a new PR

* Move browser to index
This commit is contained in:
Rijk van Zanten
2021-07-27 00:02:24 +02:00
committed by GitHub
parent 47e9d2f1fe
commit 92e1ee77bd
121 changed files with 792 additions and 261 deletions

View File

@@ -7,16 +7,8 @@ import { OpenAPIObject, OperationObject, PathItemObject, SchemaObject, TagObject
import { version } from '../../package.json';
import getDatabase from '../database';
import env from '../env';
import {
AbstractServiceOptions,
Accountability,
Collection,
Field,
Permission,
Relation,
SchemaOverview,
types,
} from '../types';
import { AbstractServiceOptions, Accountability, Collection, Permission, Relation, SchemaOverview } from '../types';
import { Field, Type } from '@directus/shared/types';
import { getRelationType } from '../utils/get-relation-type';
import { CollectionsService } from './collections';
import { FieldsService } from './fields';
@@ -459,20 +451,33 @@ class OASSpecsService implements SpecificationSubService {
}
private fieldTypes: Record<
typeof types[number],
Type,
{
type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'integer' | 'null' | undefined;
format?: string;
items?: any;
}
> = {
alias: {
type: 'string',
},
bigInteger: {
type: 'integer',
format: 'int64',
},
binary: {
type: 'string',
format: 'binary',
},
boolean: {
type: 'boolean',
},
csv: {
type: 'array',
items: {
type: 'string',
},
},
date: {
type: 'string',
format: 'date',
@@ -488,6 +493,9 @@ class OASSpecsService implements SpecificationSubService {
type: 'number',
format: 'float',
},
hash: {
type: 'string',
},
integer: {
type: 'integer',
},
@@ -511,23 +519,13 @@ class OASSpecsService implements SpecificationSubService {
type: 'string',
format: 'timestamp',
},
binary: {
type: 'string',
format: 'binary',
unknown: {
type: undefined,
},
uuid: {
type: 'string',
format: 'uuid',
},
csv: {
type: 'array',
items: {
type: 'string',
},
},
hash: {
type: 'string',
},
};
}