feat: inputColor 支持配置弹层选择器

This commit is contained in:
jinye 2024-05-23 19:28:44 +08:00 committed by lmaomaoz
parent 655e554613
commit 4a677ed823
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