fix(ui): renders custom row labels

This commit is contained in:
Jacob Fletcher
2024-03-20 22:49:43 -04:00
parent 5ae537f23c
commit d956055795
10 changed files with 82 additions and 42 deletions

View File

@@ -32,7 +32,7 @@ import './index.scss'
const baseClass = 'array-field'
export type ArrayFieldProps = FormFieldBase & {
RowLabel?: React.ReactNode
CustomRowLabel?: React.ReactNode
fieldMap: FieldMap
forceRender?: boolean
indexPath: string
@@ -51,7 +51,7 @@ export const ArrayField: React.FC<ArrayFieldProps> = (props) => {
CustomDescription,
CustomError,
CustomLabel,
RowLabel,
CustomRowLabel,
className,
descriptionProps,
errorProps,
@@ -252,7 +252,7 @@ export const ArrayField: React.FC<ArrayFieldProps> = (props) => {
{(draggableSortableItemProps) => (
<ArrayRow
{...draggableSortableItemProps}
CustomRowLabel={RowLabel}
CustomRowLabel={CustomRowLabel}
addRow={addRow}
duplicateRow={duplicateRow}
fieldMap={fieldMap}

View File

@@ -14,7 +14,6 @@ import { Pill } from '../../elements/Pill/index.js'
import { useFormSubmitted } from '../../forms/Form/context.js'
import { RenderFields } from '../../forms/RenderFields/index.js'
import { useTranslation } from '../../providers/Translation/index.js'
import { HiddenInput } from '../HiddenInput/index.js'
import { RowActions } from './RowActions.js'
import { SectionTitle } from './SectionTitle/index.js'

View File

@@ -1,6 +1,5 @@
/* eslint-disable react/destructuring-assignment */
'use client'
import type { DocumentPreferences } from 'payload/types'
import type { DocumentPreferences, RowLabel } from 'payload/types'
import React, { Fragment, useCallback, useEffect, useState } from 'react'
@@ -19,7 +18,6 @@ import './index.scss'
const baseClass = 'collapsible-field'
import type { FieldPermissions } from 'payload/auth'
import type { FieldBase } from 'payload/types'
import { FieldDescription } from '@payloadcms/ui/forms/FieldDescription'
import { FieldLabel } from '@payloadcms/ui/forms/FieldLabel'
@@ -31,7 +29,7 @@ export type CollapsibleFieldProps = FormFieldBase & {
fieldMap: FieldMap
indexPath: string
initCollapsed?: boolean
label?: FieldBase['label']
label?: RowLabel
permissions: FieldPermissions
width?: string
}

View File

@@ -44,12 +44,10 @@ export const UploadInput: React.FC<UploadInputProps> = (props) => {
descriptionProps,
errorProps,
filterOptions,
label,
labelProps,
onChange,
readOnly,
relationTo,
required,
serverURL,
showError,
style,