Commit 5509a15
fix: Support input prop override in Field component (#1066)
Fixes #1048
In v6.x, users could pass an `input` prop to override or extend the
field's input properties. This broke in v7.0.0 because the `input` prop
wasn't being destructured and merged with `field.input`.
Changes:
- Destructure `input` prop from Field component props
- Merge provided `input` with `field.input` (user props take precedence)
- Add `input?: Partial<FieldInputProps>` to FieldProps interface
- Apply merged input to all render paths (children function, string component, custom component)
This restores v6.x behavior while maintaining v7.0.0 improvements.
Example usage:
```tsx
<Field
name="email"
component={MyInput}
input={{
onChange: customOnChange, // Override onChange
value: customValue, // Override value
}}
/>
```
Co-authored-by: erikras-gilfoyle-agent <gilfoyle@openclaw.local>1 parent f25a24e commit 5509a15
3 files changed
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
55 | 61 | | |
56 | 62 | | |
57 | 63 | | |
58 | 64 | | |
59 | 65 | | |
60 | | - | |
| 66 | + | |
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
64 | 70 | | |
65 | | - | |
| 71 | + | |
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
| |||
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
89 | | - | |
| 95 | + | |
90 | 96 | | |
91 | 97 | | |
92 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| |||
0 commit comments