Skip to content

Commit d39c649

Browse files
committed
fix(filterrules): use cloneDeep replace clone
fix #604
1 parent 5fe556b commit d39c649

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/filterRules/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { message } from 'antd';
33
import { InternalNamePath } from 'antd/lib/form/interface';
4-
import { clone } from 'lodash-es';
4+
import { cloneDeep } from 'lodash-es';
55
import shortId from 'shortid';
66

77
import useLocale from '../locale/useLocale';
@@ -89,7 +89,7 @@ const FilterRules = <T,>(props: IProps<T>) => {
8989
};
9090

9191
const handleAddCondition = (keyObj: { key: string; isOut?: boolean }) => {
92-
const cloneData = clone(value);
92+
const cloneData = cloneDeep(value);
9393
const appendNode = findRelationNode(cloneData as IFilterValue<T>, keyObj.key, keyObj.isOut);
9494
addCondition(appendNode, keyObj, initValues as T);
9595
onChange?.(cloneData);
@@ -150,7 +150,7 @@ const FilterRules = <T,>(props: IProps<T>) => {
150150
};
151151

152152
const handleDeleteCondition = (key: string) => {
153-
const cloneData = clone(value);
153+
const cloneData = cloneDeep(value);
154154
const deleteNode = findRelationNode(cloneData as IFilterValue<T>, key, false);
155155
if (notEmpty.data && !deleteNode?.children) return message.info(notEmpty.message);
156156
if (!notEmpty.data && !deleteNode?.children) {
@@ -192,7 +192,7 @@ const FilterRules = <T,>(props: IProps<T>) => {
192192

193193
// 更改条件节点的条件
194194
const handleChangeCondition = (key: string, type: ROW_PERMISSION_RELATION) => {
195-
const cloneData = clone(value);
195+
const cloneData = cloneDeep(value);
196196
const changeNode = findRelationNode(
197197
cloneData as IFilterValue<T>,
198198
key,
@@ -207,7 +207,7 @@ const FilterRules = <T,>(props: IProps<T>) => {
207207

208208
// 改变节点的的数据
209209
const handleChangeRowValues = (key: string, values: T) => {
210-
const cloneData = clone(value);
210+
const cloneData = cloneDeep(value);
211211
const changeNode = findRelationNode(
212212
cloneData as IFilterValue<T>,
213213
key,

0 commit comments

Comments
 (0)