Ability to write placeholder in routing forms (#7054)

pull/7071/head
darshan 2023-02-13 18:43:24 +05:30 committed by GitHub
parent d59cda3286
commit 74fe20802d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -50,6 +50,7 @@ export default function FormInputFields(props: Props) {
<div className="flex rounded-sm">
<Component
value={response[field.id]?.value}
placeholder={field.placeholder ?? ""}
// required property isn't accepted by query-builder types
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/* @ts-ignore */

View File

@ -139,6 +139,15 @@ function Field({
onChange={(e) => setUserChangedIdentifier(e.target.value)}
/>
</div>
<div className="mb-6 w-full">
<TextField
disabled={!!router}
label="Placeholder"
placeholder="This will be the placeholder"
defaultValue={routerField?.placeholder}
{...hookForm.register(`${hookFieldNamespace}.placeholder`)}
/>
</div>
<div className="mb-6 w-full ">
<Controller
name={`${hookFieldNamespace}.type`}

View File

@ -4,6 +4,7 @@ export const zodNonRouterField = z.object({
id: z.string(),
label: z.string(),
identifier: z.string().optional(),
placeholder: z.string().optional(),
type: z.string(),
selectText: z.string().optional(),
required: z.boolean().optional(),