diff --git a/docs/zh-CN/components/form/condition-builder.md b/docs/zh-CN/components/form/condition-builder.md index b2dbe6e15..2da1946d7 100644 --- a/docs/zh-CN/components/form/condition-builder.md +++ b/docs/zh-CN/components/form/condition-builder.md @@ -1279,7 +1279,7 @@ selectMode 为`chained`时,使用`source`字段 } ] }, - "formula": { + "formulaForIf": { "mode":"input-group", "variables": [ { @@ -1435,7 +1435,9 @@ selectMode 为`chained`时,使用`source`字段 | addBtnVisibleOn | `string` | | 表达式:控制按钮“添加条件”的显示。参数为`depth`、`breadth`,分别代表深度、长度。表达式需要返回`boolean`类型 | `3.2.0` | | addGroupBtnVisibleOn | `string` | | 表达式:控制按钮“添加条件组”的显示。参数为`depth`、`breadth`,分别代表深度、长度。表达式需要返回`boolean`类型 | `3.2.0` | | inputSettings | `InputSettings` | | 开启公式编辑模式时的输入控件类型 | `3.2.0` | +| formula | `object` | | 字段输入控件变成公式编辑器。 | `3.2.0` | | showIf | `boolean` | | 开启后条件中额外还能配置启动条件。 | `3.2.0` | +| formulaForIf | `object` | | 给 showIF 表达式用的公式信息 | `3.4.0` | ### InputSettings diff --git a/packages/amis-ui/src/components/condition-builder/Group.tsx b/packages/amis-ui/src/components/condition-builder/Group.tsx index 243f898dd..e999a2218 100644 --- a/packages/amis-ui/src/components/condition-builder/Group.tsx +++ b/packages/amis-ui/src/components/condition-builder/Group.tsx @@ -32,6 +32,7 @@ export interface ConditionGroupProps extends ThemeProps, LocaleProps { showNot?: boolean; showANDOR?: boolean; showIf?: boolean; + formulaForIf?: FormulaPickerProps; data?: any; disabled?: boolean; searchable?: boolean; @@ -194,7 +195,8 @@ export class ConditionGroup extends React.Component< depth, isAddBtnVisibleOn, isAddGroupBtnVisibleOn, - showIf + showIf, + formulaForIf } = this.props; const {isCollapsed} = this.state; @@ -286,6 +288,7 @@ export class ConditionGroup extends React.Component< isAddBtnVisibleOn={isAddBtnVisibleOn} isAddGroupBtnVisibleOn={isAddGroupBtnVisibleOn} showIf={showIf} + formulaForIf={formulaForIf} /> )) ) : ( diff --git a/packages/amis-ui/src/components/condition-builder/GroupOrItem.tsx b/packages/amis-ui/src/components/condition-builder/GroupOrItem.tsx index 5ece6c451..e3d20cb34 100644 --- a/packages/amis-ui/src/components/condition-builder/GroupOrItem.tsx +++ b/packages/amis-ui/src/components/condition-builder/GroupOrItem.tsx @@ -35,6 +35,7 @@ export interface CBGroupOrItemProps extends ThemeProps { isAddBtnVisibleOn?: (param: {depth: number; breadth: number}) => boolean; isAddGroupBtnVisibleOn?: (param: {depth: number; breadth: number}) => boolean; showIf?: boolean; + formulaForIf?: FormulaPickerProps; } export class CBGroupOrItem extends React.Component { @@ -101,6 +102,7 @@ export class CBGroupOrItem extends React.Component { isAddBtnVisibleOn, isAddGroupBtnVisibleOn, showIf, + formulaForIf, mobileUI } = this.props; @@ -152,6 +154,7 @@ export class CBGroupOrItem extends React.Component { isAddBtnVisibleOn={isAddBtnVisibleOn} isAddGroupBtnVisibleOn={isAddGroupBtnVisibleOn} showIf={showIf} + formulaForIf={formulaForIf} /> ) : ( @@ -182,7 +185,7 @@ export class CBGroupOrItem extends React.Component { /> {showIf ? ( void; @@ -263,7 +264,8 @@ export class QueryBuilder extends React.Component< selectMode, isAddBtnVisibleOn, isAddGroupBtnVisibleOn, - showIf + showIf, + formulaForIf } = this.props; const normalizedValue = Array.isArray(value?.children) @@ -308,6 +310,7 @@ export class QueryBuilder extends React.Component< isAddBtnVisibleOn={isAddBtnVisibleOn} isAddGroupBtnVisibleOn={isAddGroupBtnVisibleOn} showIf={showIf} + formulaForIf={formulaForIf} /> ); }