feat: inputColor 支持配置弹层选择器 (#10300)

Co-authored-by: jinye <jinye@baidu.com>
This commit is contained in:
lmaomaoz 2024-05-24 10:32:07 +08:00 committed by GitHub
parent b427168b67
commit 71f634668c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 8 deletions

View File

@ -84,11 +84,12 @@ List 的内容、Card 卡片的内容配置同上
## 属性表
| 属性名 | 类型 | 默认值 | 说明 |
| ------------ | --------- | ------ | -------------------------------------------------------------------------------------- |
| type | `string` | | 如果在 Table、Card 和 List 中,为`"color"`;在 Form 中用作静态展示,为`"static-color"` |
| className | `string` | | 外层 CSS 类名 |
| value | `string` | | 显示的颜色值 |
| name | `string` | | 在其他组件中,时,用作变量映射 |
| defaultColor | `string` | | 默认颜色值 |
| showValue | `boolean` | `true` | 是否显示右边的颜色值 |
| 属性名 | 类型 | 默认值 | 说明 |
| ------------------------ | --------- | ------ | -------------------------------------------------------------------------------------- | ------- |
| type | `string` | | 如果在 Table、Card 和 List 中,为`"color"`;在 Form 中用作静态展示,为`"static-color"` |
| className | `string` | | 外层 CSS 类名 |
| value | `string` | | 显示的颜色值 |
| name | `string` | | 在其他组件中,时,用作变量映射 |
| defaultColor | `string` | | 默认颜色值 |
| showValue | `boolean` | `true` | 是否显示右边的颜色值 |
| popOverContainerSelector | `string` | | 弹层挂载位置选择器,会通过`querySelector`获取 | `6.4.2` |

View File

@ -342,6 +342,8 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
? null
: React.isValidElement(schema.children)
? schema.children
: typeof schema.children !== 'function'
? null
: (schema.children as Function)({
...rest,
...exprProps,

View File

@ -27,6 +27,7 @@ export interface ColorProps extends LocaleProps, ThemeProps {
popoverClassName?: string;
disabled?: boolean;
popOverContainer?: any;
popOverContainerSelector?: string;
placement?: string;
value?: any;
onChange: (value: any) => void;
@ -243,6 +244,7 @@ export class ColorControl extends React.PureComponent<
placeholder,
disabled,
popOverContainer,
popOverContainerSelector,
format,
clearable,
placement,
@ -313,6 +315,7 @@ export class ColorControl extends React.PureComponent<
target={() => findDOMNode(this)}
onHide={this.close}
container={popOverContainer || (() => findDOMNode(this))}
containerSelector={popOverContainerSelector}
rootClose={false}
show
>

View File

@ -46,6 +46,10 @@ export interface InputColorControlSchema extends FormBaseControlSchema {
*
*/
allowCustomColor?: boolean;
/**
*
*/
popOverContainerSelector?: string;
}
export interface ColorProps