From 4a677ed82331367f965e1ddf3402c4d5d8cfe754 Mon Sep 17 00:00:00 2001 From: jinye Date: Thu, 23 May 2024 19:28:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20inputColor=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=BC=B9=E5=B1=82=E9=80=89=E6=8B=A9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/zh-CN/components/color.md | 17 +++++++++-------- packages/amis-core/src/SchemaRenderer.tsx | 2 ++ packages/amis-ui/src/components/ColorPicker.tsx | 3 +++ packages/amis/src/renderers/Form/InputColor.tsx | 4 ++++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/zh-CN/components/color.md b/docs/zh-CN/components/color.md index 084fb5af7..48522b084 100755 --- a/docs/zh-CN/components/color.md +++ b/docs/zh-CN/components/color.md @@ -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` | diff --git a/packages/amis-core/src/SchemaRenderer.tsx b/packages/amis-core/src/SchemaRenderer.tsx index 67994cff1..e5309f55d 100644 --- a/packages/amis-core/src/SchemaRenderer.tsx +++ b/packages/amis-core/src/SchemaRenderer.tsx @@ -342,6 +342,8 @@ export class SchemaRenderer extends React.Component { ? null : React.isValidElement(schema.children) ? schema.children + : typeof schema.children !== 'function' + ? null : (schema.children as Function)({ ...rest, ...exprProps, diff --git a/packages/amis-ui/src/components/ColorPicker.tsx b/packages/amis-ui/src/components/ColorPicker.tsx index 01ff932ff..1f9f134e4 100644 --- a/packages/amis-ui/src/components/ColorPicker.tsx +++ b/packages/amis-ui/src/components/ColorPicker.tsx @@ -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 > diff --git a/packages/amis/src/renderers/Form/InputColor.tsx b/packages/amis/src/renderers/Form/InputColor.tsx index 5152e3922..0e8cae6e7 100644 --- a/packages/amis/src/renderers/Form/InputColor.tsx +++ b/packages/amis/src/renderers/Form/InputColor.tsx @@ -46,6 +46,10 @@ export interface InputColorControlSchema extends FormBaseControlSchema { * 是否允许用户输入颜色。 */ allowCustomColor?: boolean; + /** + * 弹窗容器选择器 + */ + popOverContainerSelector?: string; } export interface ColorProps