From 9d8d18033e418528abc97bec9e39a81f8d11315c Mon Sep 17 00:00:00 2001 From: star-hamster <52915367+star-hamster@users.noreply.github.com> Date: Fri, 5 May 2023 21:50:25 +0800 Subject: [PATCH] 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 --- packages/react-form/README.md | 40 +++++++++++++++++++- packages/react-overlay-trigger/src/index.tsx | 3 +- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/packages/react-form/README.md b/packages/react-form/README.md index bd870b5bfe..8e3a76d078 100644 --- a/packages/react-form/README.md +++ b/packages/react-form/README.md @@ -98,7 +98,7 @@ export default function Demo() { ```jsx mdx:preview&bg=#fff import React from 'react'; -import { Form, Input, Notify, Checkbox, Switch, RadioGroup, Radio, Textarea, Row, Col, Button } from 'uiw'; +import { Form, Input, Notify, Checkbox, Switch, RadioGroup, Radio, Textarea, Row, Col, Button, Select, SearchSelect } from 'uiw'; export default function Demo() { return( @@ -142,6 +142,40 @@ export default function Demo() { label: '年龄', children: }, + select: { + children: ( + + ) + }, + searchSelect: { + initialValue:[{label: 'a7', value: 7},{label: 'a8', value: 8}], + children: ( + + ) + }, checkbox: { initialValue: ['四川菜'], label: '选择你想吃的菜', @@ -206,6 +240,10 @@ export default function Demo() { {fields.userName} {fields.age} + + {fields.select} + {fields.searchSelect} + {fields.checkbox} {fields.checkboxOne} diff --git a/packages/react-overlay-trigger/src/index.tsx b/packages/react-overlay-trigger/src/index.tsx index 7d52f7a4cd..94cd5664a9 100644 --- a/packages/react-overlay-trigger/src/index.tsx +++ b/packages/react-overlay-trigger/src/index.tsx @@ -307,6 +307,7 @@ export default React.forwardRef((props, } } overlayProps.style = { ...overlayProps.style, ...overlayStyl }; + return ( {cloneElement( @@ -314,7 +315,7 @@ export default React.forwardRef((props, Object.assign({}, child.props, { ...triggerProps, ref: triggerRef, - style: { zIndex: zIndex.current }, + style: { ...child.props?.style, zIndex: zIndex.current }, className: [child.props.className, disabled ? `${prefixCls}-disabled` : null] .filter(Boolean) .join(' ')