Skip to content

Commit 9d8d180

Browse files
star-hamstershenzhiqing
andauthored
fix(OverlayTrigger): fix children style props issue. fix #962 (#963)
* fix(overlaytrigger): Fix the issue of invalid styles #962 * update(form): add example --------- Co-authored-by: shenzhiqing <[email protected]>
1 parent 11fca0e commit 9d8d180

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

packages/react-form/README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default function Demo() {
9898

9999
```jsx mdx:preview&bg=#fff
100100
import React from 'react';
101-
import { Form, Input, Notify, Checkbox, Switch, RadioGroup, Radio, Textarea, Row, Col, Button } from 'uiw';
101+
import { Form, Input, Notify, Checkbox, Switch, RadioGroup, Radio, Textarea, Row, Col, Button, Select, SearchSelect } from 'uiw';
102102

103103
export default function Demo() {
104104
return(
@@ -142,6 +142,40 @@ export default function Demo() {
142142
label: '年龄',
143143
children: <Input type="number" />
144144
},
145+
select: {
146+
children: (
147+
<Select>
148+
<Select.Option value="w">Choose an item...</Select.Option>
149+
<Select.Option value="1">One</Select.Option>
150+
<Select.Option value="2">Two</Select.Option>
151+
<Select.Option value="3">Three</Select.Option>
152+
<Select.Option value="4">Four</Select.Option>
153+
</Select>
154+
)
155+
},
156+
searchSelect: {
157+
initialValue:[{label: 'a7', value: 7},{label: 'a8', value: 8}],
158+
children: (
159+
<SearchSelect
160+
allowClear
161+
labelInValue={true}
162+
showSearch={true}
163+
mode="multiple"
164+
disabled={false}
165+
placeholder="请选择选项"
166+
option={[
167+
{ label: 'a1', value: 1 },
168+
{ label: 'a2', value: 2 },
169+
{ label: 'a3', value: 3 },
170+
{ label: 'a4', value: 4 },
171+
{ label: 'a5', value: 5 },
172+
{ label: 'a6', value: 6 },
173+
{ label: 'a7', value: 7 },
174+
{ label: 'a8', value: 8 },
175+
]}
176+
/>
177+
)
178+
},
145179
checkbox: {
146180
initialValue: ['四川菜'],
147181
label: '选择你想吃的菜',
@@ -206,6 +240,10 @@ export default function Demo() {
206240
<Col>{fields.userName}</Col>
207241
<Col>{fields.age}</Col>
208242
</Row>
243+
<Row gutter={10}>
244+
<Col>{fields.select}</Col>
245+
<Col>{fields.searchSelect}</Col>
246+
</Row>
209247
<Row gutter={10}>
210248
<Col>{fields.checkbox}</Col>
211249
<Col>{fields.checkboxOne}</Col>

packages/react-overlay-trigger/src/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,15 @@ export default React.forwardRef<OverlayTriggerRef, OverlayTriggerProps>((props,
307307
}
308308
}
309309
overlayProps.style = { ...overlayProps.style, ...overlayStyl };
310+
310311
return (
311312
<React.Fragment>
312313
{cloneElement(
313314
child,
314315
Object.assign({}, child.props, {
315316
...triggerProps,
316317
ref: triggerRef,
317-
style: { zIndex: zIndex.current },
318+
style: { ...child.props?.style, zIndex: zIndex.current },
318319
className: [child.props.className, disabled ? `${prefixCls}-disabled` : null]
319320
.filter(Boolean)
320321
.join(' ')

0 commit comments

Comments
 (0)