test tree

This commit is contained in:
2023-05-15 09:51:49 +08:00
parent 5400ed7cdc
commit 4b56b2b09c
6 changed files with 69 additions and 86 deletions

View File

@@ -83,7 +83,7 @@ function recursiveNodeClick(node: TreeData) {
}
function handleChange(checked: boolean, node: TreeData) {
props.tree.setCheckedKeys(checked, props.checkStrictly, node);
props.tree.setCheckedKeys(checked, props.checkStrictly && props.selectParent, node);
}
function handleIconClick(node: TreeData) {

View File

@@ -17,7 +17,6 @@ export interface TreeData {
isLeaf: boolean;
hasNextSibling: boolean;
parentNode: Nullable<TreeData>;
selectParent:boolean;
}
interface ReplaceFields {
@@ -100,7 +99,6 @@ class Tree {
const nodeTitle = Reflect.get(origin, title);
const nodeChildren = Reflect.get(origin, children);
const nodeDisabled = !!Reflect.get(origin, "disabled");
const selectParent = !!Reflect.get(origin, "selectParent");
const nodeIsLeaf = !!Reflect.get(origin, "spread");
const parentNode = nodeMap.get(parentKey);
@@ -114,8 +112,7 @@ class Tree {
isChecked: false,
isLeaf: false,
hasNextSibling: hasNextSibling,
parentNode: parentNode || null,
selectParent: selectParent
parentNode: parentNode || null
});
node.isDisabled = nodeDisabled;
@@ -187,9 +184,6 @@ class Tree {
) {
node.isChecked = checked;
console.log(node)
if (node.selectParent) {
return false;
}
if (!checkStrictly) {
if (node.parentNode) {
this.setParentChecked(checked, node.parentNode);