Skip to content

Commit 1821c28

Browse files
committed
fixes
1 parent 68f2748 commit 1821c28

File tree

3 files changed

+26
-24
lines changed

3 files changed

+26
-24
lines changed

demo/src/samples/widgets.tsx

+19-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Sample } from './Sample';
1+
import { Sample } from './Sample'
22

33
const widgets: Sample = {
44
schema: {
@@ -146,19 +146,19 @@ const widgets: Sample = {
146146
onChange,
147147
options,
148148
}: {
149-
value: any;
150-
onChange: (value: any) => void;
151-
options: { backgroundColor: string };
149+
value: any
150+
onChange: (value: any) => void
151+
options: { backgroundColor: string }
152152
}) => {
153-
const { backgroundColor } = options;
153+
const { backgroundColor } = options
154154
return (
155155
<input
156-
className='form-control'
156+
className="custom-classname"
157157
onChange={(event) => onChange(event.target.value)}
158158
style={{ backgroundColor }}
159159
value={value}
160160
/>
161-
);
161+
)
162162
},
163163
'ui:options': {
164164
backgroundColor: 'yellow',
@@ -170,14 +170,17 @@ const widgets: Sample = {
170170
onChange,
171171
options,
172172
}: {
173-
value: any;
174-
onChange: (value: any) => void;
175-
options: { enumOptions: { label: string; value: any }[]; backgroundColor: string };
173+
value: any
174+
onChange: (value: any) => void
175+
options: {
176+
enumOptions: { label: string; value: any }[]
177+
backgroundColor: string
178+
}
176179
}) => {
177-
const { enumOptions, backgroundColor } = options;
180+
const { enumOptions, backgroundColor } = options
178181
return (
179182
<select
180-
className='form-control'
183+
className="form-control"
181184
style={{ backgroundColor }}
182185
value={value}
183186
onChange={(event) => onChange(event.target.value)}
@@ -187,10 +190,10 @@ const widgets: Sample = {
187190
<option key={i} value={value}>
188191
{label}
189192
</option>
190-
);
193+
)
191194
})}
192195
</select>
193-
);
196+
)
194197
},
195198
'ui:options': {
196199
backgroundColor: 'pink',
@@ -213,6 +216,6 @@ const widgets: Sample = {
213216
},
214217
secret: "I'm a hidden string.",
215218
},
216-
};
219+
}
217220

218-
export default widgets;
221+
export default widgets

src/components/WidgetRadio.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export default function RadioWidget<
4444
return (
4545
<div style={{ marginTop: '1rem', marginBottom: '-1rem' }}>
4646
<RadioButtons
47+
orientation={inline ? 'horizontal' : 'vertical'}
4748
options={
4849
(options &&
4950
options.enumOptions?.map((option) => {

src/components/WidgetSelect.tsx

+6-8
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default function <
5959

6060
const uiOptions = getUiOptions<T, S, F>(uiSchema)
6161
const backgroundColor = (uiOptions.backgroundColor as string) || 'auto'
62-
62+
const placeholder = uiOptions.placeholder || props.options.placeholder
6363
return (
6464
<Select
6565
nativeSelectProps={{
@@ -75,13 +75,11 @@ export default function <
7575
label={undefined}
7676
{...props}
7777
>
78-
{(!props.multiple &&
79-
props.schema.default === undefined &&
80-
props.options.placeholder && (
81-
<option value="" disabled selected>
82-
{props.options.placeholder}
83-
</option>
84-
)) || (
78+
{(!props.multiple && placeholder && (
79+
<option value="" disabled selected>
80+
{placeholder}
81+
</option>
82+
)) || (
8583
<option value="" disabled selected>
8684
Séléctionner une option
8785
</option>

0 commit comments

Comments
 (0)