...
|
...
|
@@ -9,9 +9,8 @@ export enum FieldBaseType { |
9
|
9
|
YEAR_SEC = 'DATE',
|
10
|
10
|
}
|
11
|
11
|
|
12
|
|
-
|
13
|
12
|
export const QxBaseCondition: React.FC<QxBaseConditionProps> = (props) => {
|
14
|
|
- const [localOptions, setLocalOptions] = useState(props.value || props.options || []);
|
|
13
|
+ const [localOptions, setLocalOptions] = useState(props.options || []);
|
15
|
14
|
|
16
|
15
|
const getDefaultConditionOptions = (item: QxBaseConditionField) => ({
|
17
|
16
|
...item,
|
...
|
...
|
@@ -36,7 +35,7 @@ export const QxBaseCondition: React.FC<QxBaseConditionProps> = (props) => { |
36
|
35
|
const handleDelete = (key: number) => {
|
37
|
36
|
localOptions.splice(key, 1);
|
38
|
37
|
setLocalOptions([...localOptions]);
|
39
|
|
- props.onChange?.([...localOptions])
|
|
38
|
+ props.onChange?.([...localOptions]);
|
40
|
39
|
};
|
41
|
40
|
|
42
|
41
|
useEffect(() => {
|
...
|
...
|
@@ -52,12 +51,18 @@ export const QxBaseCondition: React.FC<QxBaseConditionProps> = (props) => { |
52
|
51
|
key={item.code || key}
|
53
|
52
|
mode={props.mode}
|
54
|
53
|
{...item}
|
55
|
|
- value={props.value?.[key] || getDefaultConditionOptions(item)}
|
|
54
|
+ value={Object.assign(
|
|
55
|
+ {},
|
|
56
|
+ getDefaultConditionOptions(item),
|
|
57
|
+ props.value?.[key] || {},
|
|
58
|
+ )}
|
56
|
59
|
field={item}
|
57
|
60
|
onChange={(val) => handleItemChange(val, key)}
|
58
|
61
|
remove={() => handleDelete(key)}
|
59
|
62
|
ValueAssignmentPopup={
|
60
|
|
- (item.showValueAssignmentPopup ?? true) ? props.ValueAssignmentPopup : undefined
|
|
63
|
+ item.showValueAssignmentPopup ?? true
|
|
64
|
+ ? props.ValueAssignmentPopup
|
|
65
|
+ : undefined
|
61
|
66
|
}
|
62
|
67
|
/>
|
63
|
68
|
</div>
|
...
|
...
|
@@ -86,7 +91,7 @@ export interface QxBaseConditionOptionsProps extends QxBaseConditionField { |
86
|
91
|
[key: string]: any;
|
87
|
92
|
}
|
88
|
93
|
|
89
|
|
-export type QxBaseConditionMode = 'condition' | 'variable'
|
|
94
|
+export type QxBaseConditionMode = 'condition' | 'variable';
|
90
|
95
|
|
91
|
96
|
export interface QxBaseConditionProps {
|
92
|
97
|
showIdx?: boolean;
|
...
|
...
|
|