import { RelationType } from 'typeorm/metadata/types/RelationTypes'; import { InputType } from '../'; import { LabelOptions } from './'; /** * Options provided to AdminField decorator. */ export interface AdminFieldOptions { /** * Property type. This value is injected automatically via 'reflect-metadata' module. */ type?: string; /** * Label to be displayed with the input. * Defaults to object property name. */ label?: string | LabelOptions; /** * Property marked as 'disabled: true' will be rendered as disabled input. * Defaults to false. */ disabled?: boolean; /** * Property marked as 'editable: true" will be available for interacting on creation but non-available on updating * existing entity. * Defaults to false. */ editable?: boolean; /** * Property marked as "searchable: true" will be available for interaction in the search menu. * Defaults to false. */ searchable?: boolean; /** * Marks related column in list view with bold. * Defaults to false. */ highlighted?: boolean; /** * Directive to show this property in admin list view. * Defaults to true. */ showInList?: boolean; /** * Requirement for the input to be filled in before sending form data. * Defaults to 'true'. */ required?: boolean; /** * Type of input that should be provided on the admin page. Supports all default input types plus 'textarea' and * 'nestedAdmin'. * Defaults to 'text'. */ inputType?: InputType; /** * Mark input as supporting multiple values. Required for [] types. * Defaults to false. */ multiple?: boolean; /** * Amount of rows of a text area. Only applicable for 'inputType: "textarea"'. * Defaults to 5. */ rows?: number; /** * Allow adding new items via nested menu. * NOTE: This option is only applicable to nestedAdmin-typed fields. */ allowAdd?: boolean; /** * Allow deleting items via nested menu. * NOTE: This option is only applicable to nestedAdmin-typed fields. */ allowRemove?: boolean; /** * Array of possible enum values. These values will be sent on form submit. * NOTE: This array is used to display options for select and radio input types. */ enumValues?: any[]; /** * Array of readable enum values. These values will be displayed on the form. * NOTE: This array is used to display options for select and radio input types. */ readableEnumValues?: any[]; /** * Escape real value replacing it with stars. * Defaults to false. */ escape?: boolean; /** * Help text to provide additional description for inputs. */ helpText?: string; /** * Default value to be used as filled in data when creating entity. */ defaultValue?: any; /** * Temporary measure to speed up development. Put the relation type here. * NOTE: only use with nested admins. */ relationType?: RelationType; }