fix: updates field description type to include react nodes

This commit is contained in:
Jacob Fletcher
2021-11-10 11:12:52 -05:00
parent a7525e2931
commit 291c193ad4
5 changed files with 25 additions and 23 deletions

View File

@@ -2,9 +2,9 @@ import React from 'react';
export type DescriptionFunction = (value: unknown) => string
export type DescriptionComponent = React.ComponentType<{value: unknown}>
export type DescriptionComponent = React.ComponentType<{ value: unknown }>
type Description = string | DescriptionFunction | DescriptionComponent
export type Description = string | DescriptionFunction | DescriptionComponent
export type Props = {
description?: Description

View File

@@ -1,7 +1,8 @@
import { Data } from '../../Form/types';
import { ArrayField, Labels, Field, Description } from '../../../../../fields/config/types';
import { ArrayField, Labels, Field } from '../../../../../fields/config/types';
import { FieldTypes } from '..';
import { FieldPermissions } from '../../../../../auth/types';
import { Description } from '../../FieldDescription/types';
export type Props = Omit<ArrayField, 'type'> & {
path?: string

View File

@@ -1,7 +1,8 @@
import { Data } from '../../Form/types';
import { BlockField, Labels, Block, Description } from '../../../../../fields/config/types';
import { BlockField, Labels, Block } from '../../../../../fields/config/types';
import { FieldTypes } from '..';
import { FieldPermissions } from '../../../../../auth/types';
import { Description } from '../../FieldDescription/types';
export type Props = Omit<BlockField, 'type'> & {
path?: string

View File

@@ -1,5 +1,6 @@
import React from 'react';
import { Description, Validate } from '../../../../../fields/config/types';
import { Validate } from '../../../../../fields/config/types';
import { Description } from '../../FieldDescription/types';
export type Props = {
autoComplete?: string

View File

@@ -4,6 +4,7 @@ import { Editor } from 'slate';
import { PayloadRequest } from '../../express/types';
import { Document } from '../../types';
import { ConditionalDateProps } from '../../admin/components/elements/DatePicker/types';
import { Description } from '../../admin/components/forms/FieldDescription/types';
export type FieldHook = (args: {
value?: unknown,
@@ -40,8 +41,6 @@ type Admin = {
hidden?: boolean
}
export type Description = string | ((value: Record<string, unknown>) => string);
export type Labels = {
singular: string;
plural: string;
@@ -302,22 +301,22 @@ export type FieldAffectingData =
| PointField
export type NonPresentationalField = TextField
| NumberField
| EmailField
| TextareaField
| CheckboxField
| DateField
| BlockField
| GroupField
| RadioField
| RelationshipField
| ArrayField
| RichTextField
| SelectField
| UploadField
| CodeField
| PointField
| RowField;
| NumberField
| EmailField
| TextareaField
| CheckboxField
| DateField
| BlockField
| GroupField
| RadioField
| RelationshipField
| ArrayField
| RichTextField
| SelectField
| UploadField
| CodeField
| PointField
| RowField;
export type FieldWithPath = Field & {
path?: string