mirror of
https://github.com/zhigang1992/firecms.git
synced 2026-06-16 02:24:23 +08:00
Added custom fields additional props
This commit is contained in:
@@ -8,14 +8,20 @@ import {
|
||||
import React, { ReactElement } from "react";
|
||||
import { CMSFieldProps } from "firecms";
|
||||
|
||||
interface CustomLargeTextFieldProps extends CMSFieldProps<string> {
|
||||
rows: number
|
||||
}
|
||||
|
||||
export default function CustomLargeTextField({
|
||||
property,
|
||||
field,
|
||||
rows,
|
||||
form: { isSubmitting, errors, touched, setFieldValue },
|
||||
...props
|
||||
}: CMSFieldProps<string>)
|
||||
}: CustomLargeTextFieldProps)
|
||||
: ReactElement {
|
||||
|
||||
console.log(props);
|
||||
const fieldError = getIn(errors, field.name);
|
||||
const showError = getIn(touched, field.name) && !!fieldError;
|
||||
|
||||
@@ -32,7 +38,7 @@ export default function CustomLargeTextField({
|
||||
<InputLabel>{property.title || field.name}</InputLabel>
|
||||
<Input
|
||||
multiline
|
||||
rows={4}
|
||||
rows={rows}
|
||||
defaultValue={value}
|
||||
onChange={(evt) => setFieldValue(
|
||||
field.name,
|
||||
|
||||
@@ -187,6 +187,9 @@ const blogSchema: EntitySchema = {
|
||||
validation: { required: true },
|
||||
dataType: "string",
|
||||
customField: CustomLargeTextField,
|
||||
customFieldProps: {
|
||||
rows: 5
|
||||
},
|
||||
includeInListView: false
|
||||
},
|
||||
content: {
|
||||
@@ -194,7 +197,7 @@ const blogSchema: EntitySchema = {
|
||||
validation: { required: true },
|
||||
dataType: "array",
|
||||
of: {
|
||||
dataType: "string",
|
||||
dataType: "string"
|
||||
},
|
||||
includeInListView: false
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user