+
+
-
-
-
添加条件
-
添加条件组
+
+
+ 添加条件
+
+
+ 添加条件组
+
- {Array.isArray(value)
- ? value.map(item =>
)
+ {Array.isArray(value?.children)
+ ? value!.children.map(item =>
+ (item as ConditionGroupValue).conjunction ? (
+
+ ) : (
+
+ )
+ )
: null}
);
diff --git a/src/components/condition-builder/ConditionItem.tsx b/src/components/condition-builder/ConditionItem.tsx
index 52a82f704..eef8bf6f7 100644
--- a/src/components/condition-builder/ConditionItem.tsx
+++ b/src/components/condition-builder/ConditionItem.tsx
@@ -1,13 +1,64 @@
import React from 'react';
import {Fields, ConditionRule, ConditionGroupValue} from './types';
+import {ClassNamesFn} from '../../theme';
+import {Icon} from '../icons';
+import Select from '../Select';
+import {autobind} from '../../utils/helper';
+import PopOverContainer from '../PopOverContainer';
+import InputBox from '../InputBox';
+import ListRadios from '../ListRadios';
+import ResultBox from '../ResultBox';
export interface ConditionItemProps {
fields: Fields;
- value: ConditionRule | ConditionGroupValue;
+ value: ConditionRule;
+ classnames: ClassNamesFn;
+ onChange: (value: ConditionRule) => void;
}
export class ConditionItem extends React.Component
{
+ @autobind
+ handleLeftSelect() {}
+
+ renderLeft() {
+ const {value, fields} = this.props;
+
+ return (
+ (
+
+ )}
+ >
+ {({onClick, ref}) => (
+
+ )}
+
+ );
+ }
+
+ renderItem() {
+ return null;
+ }
+
render() {
- return 233
;
+ const {classnames: cx} = this.props;
+
+ return (
+
+
+
+
+
+
+ {this.renderLeft()}
+ {this.renderItem()}
+
+
+ );
}
}
diff --git a/src/components/condition-builder/types.ts b/src/components/condition-builder/types.ts
index c27b0b79e..86512b036 100644
--- a/src/components/condition-builder/types.ts
+++ b/src/components/condition-builder/types.ts
@@ -40,12 +40,14 @@ export type ConditionRightValue =
};
export interface ConditionRule {
- left: string;
- op: OperatorType;
- right: ConditionRightValue | Array;
+ id: any;
+ left?: string;
+ op?: OperatorType;
+ right?: ConditionRightValue | Array;
}
export interface ConditionGroupValue {
+ id: string;
conjunction: 'and' | 'or';
not?: boolean;
children?: Array;