Tree: add filter-check-strictly property

pull/21499/head
wisen 2021-11-24 14:46:37 +08:00
parent 5390f4069e
commit dab6b9dae0
6 changed files with 14 additions and 5 deletions

View File

@ -811,7 +811,7 @@ You can drag and drop Tree nodes by adding a `draggable` attribute.
| draggable | whether enable tree nodes drag and drop | boolean | — | false | | draggable | whether enable tree nodes drag and drop | boolean | — | false |
| allow-drag | this function will be executed before dragging a node. If `false` is returned, the node can not be dragged | Function(node) | — | — | | allow-drag | this function will be executed before dragging a node. If `false` is returned, the node can not be dragged | Function(node) | — | — |
| allow-drop | this function will be executed before the dragging node is dropped. If `false` is returned, the dragging node can not be dropped at the target node. `type` has three possible values: 'prev' (inserting the dragging node before the target node), 'inner' (inserting the dragging node to the target node) and 'next' (inserting the dragging node after the target node) | Function(draggingNode, dropNode, type) | — | — | | allow-drop | this function will be executed before the dragging node is dropped. If `false` is returned, the dragging node can not be dropped at the target node. `type` has three possible values: 'prev' (inserting the dragging node before the target node), 'inner' (inserting the dragging node to the target node) and 'next' (inserting the dragging node after the target node) | Function(draggingNode, dropNode, type) | — | — |
| filter-check-strictly | Whether to check the parent time only check the filtered child when `show-checkbox` is `true` | boolean | — | false |
### props ### props
| Attribute | Description | Type | Accepted Values | Default | | Attribute | Description | Type | Accepted Values | Default |
| --------- | ---------------------------------------- | ------ | --------------- | ------- | | --------- | ---------------------------------------- | ------ | --------------- | ------- |

View File

@ -811,7 +811,7 @@ Puede arrastrar y soltar nodos de Tree añadiendo un atributo `draggable` .
| draggable | si se habilita la función de drag & drop en los nodos | boolean | — | false | | draggable | si se habilita la función de drag & drop en los nodos | boolean | — | false |
| allow-drag | esta función se ejecutará antes de arrastrar un nodo. si devuelve `false`, el nodo no puede ser arrastrado. | Function(nodo) | — | — | | allow-drag | esta función se ejecutará antes de arrastrar un nodo. si devuelve `false`, el nodo no puede ser arrastrado. | Function(nodo) | — | — |
| allow-drop | esta función se ejecutará al arrastrar y soltar un nodo. si devuelve false, el nodo arrastrando no se puede soltar en el nodo destino. `type` tiene tres valores posibles: 'prev' (insertar el nodo de arrastre antes del nodo de destino), 'inner' (insertar el nodo de arrastre en el nodo de destino) y 'next' (insertar el nodo de arrastre después del nodo de destino) | Function(Nodoquesearrastra, Nododestino, type) | — | — | | allow-drop | esta función se ejecutará al arrastrar y soltar un nodo. si devuelve false, el nodo arrastrando no se puede soltar en el nodo destino. `type` tiene tres valores posibles: 'prev' (insertar el nodo de arrastre antes del nodo de destino), 'inner' (insertar el nodo de arrastre en el nodo de destino) y 'next' (insertar el nodo de arrastre después del nodo de destino) | Function(Nodoquesearrastra, Nododestino, type) | — | — |
| filter-check-strictly | Whether to check the parent time only check the filtered child when `show-checkbox` is `true` | boolean | — | false |
### props ### props
| Atributo | Descripción | Tipo | Valores aceptados | Por defecto | | Atributo | Descripción | Tipo | Valores aceptados | Por defecto |
| -------- | ---------------------------------------- | ----------------------------- | ----------------- | ----------- | | -------- | ---------------------------------------- | ----------------------------- | ----------------- | ----------- |

View File

@ -815,7 +815,7 @@ Vous pouvez déplacer les noeuds par drag'n drop en ajoutant l'attribut `draggab
| draggable | Si les noeuds sont déplaçables par drag'n drop. | boolean | — | false | | draggable | Si les noeuds sont déplaçables par drag'n drop. | boolean | — | false |
| allow-drag | Fonction exécutée avant le déplacement d'un noeud. Si `false` est retourné, le noeud ne sera pas déplaçable. | Function(node) | — | — | | allow-drag | Fonction exécutée avant le déplacement d'un noeud. Si `false` est retourné, le noeud ne sera pas déplaçable. | Function(node) | — | — |
| allow-drop | Fonction exécutée avant le placement d'un noeud. Si `false` est retourné, le noeud ne pourra être placé sur la zone en question. `type` a trois valeurs possibles: 'prev' (insertion avant le noeud cible), 'inner' (insertion dans le noeud cible) and 'next' (insertion après le noeud cible). | Function(draggingNode, dropNode, type) | — | — | | allow-drop | Fonction exécutée avant le placement d'un noeud. Si `false` est retourné, le noeud ne pourra être placé sur la zone en question. `type` a trois valeurs possibles: 'prev' (insertion avant le noeud cible), 'inner' (insertion dans le noeud cible) and 'next' (insertion après le noeud cible). | Function(draggingNode, dropNode, type) | — | — |
| filter-check-strictly | Whether to check the parent time only check the filtered child when `show-checkbox` is `true` | boolean | — | false |
### props ### props
| Attribut | Description | Type | Valeurs acceptées | Défaut | | Attribut | Description | Type | Valeurs acceptées | Défaut |

View File

@ -820,7 +820,7 @@
| draggable | 是否开启拖拽节点功能 | boolean | — | false | | draggable | 是否开启拖拽节点功能 | boolean | — | false |
| allow-drag | 判断节点能否被拖拽 | Function(node) | — | — | | allow-drag | 判断节点能否被拖拽 | Function(node) | — | — |
| allow-drop | 拖拽时判定目标节点能否被放置。`type` 参数有三种情况:'prev'、'inner' 和 'next',分别表示放置在目标节点前、插入至目标节点和放置在目标节点后 | Function(draggingNode, dropNode, type) | — | — | | allow-drop | 拖拽时判定目标节点能否被放置。`type` 参数有三种情况:'prev'、'inner' 和 'next',分别表示放置在目标节点前、插入至目标节点和放置在目标节点后 | Function(draggingNode, dropNode, type) | — | — |
| filter-check-strictly | 在显示复选框且处于筛选状态下,选择父级是否只勾选筛选结果的子级 | boolean | — | false |
### props ### props
| 参数 | 说明 | 类型 | 可选值 | 默认值 | | 参数 | 说明 | 类型 | 可选值 | 默认值 |
| -------- | ----------------- | ------ | ---- | ---- | | -------- | ----------------- | ------ | ---- | ---- |

View File

@ -355,6 +355,9 @@ export default class Node {
setChecked(value, deep, recursion, passValue) { setChecked(value, deep, recursion, passValue) {
this.indeterminate = value === 'half'; this.indeterminate = value === 'half';
if (this.store.filterCheckStrictly && !this.visible) return;
this.checked = value === true; this.checked = value === true;
if (this.store.checkStrictly) return; if (this.store.checkStrictly) return;

View File

@ -128,7 +128,8 @@
type: Number, type: Number,
default: 18 default: 18
}, },
iconClass: String iconClass: String,
filterCheckStrictly: Boolean
}, },
computed: { computed: {
@ -173,6 +174,10 @@
checkStrictly(newVal) { checkStrictly(newVal) {
this.store.checkStrictly = newVal; this.store.checkStrictly = newVal;
},
filterCheckStrictly(newVal) {
this.store.filterCheckStrictly = newVal;
} }
}, },
@ -330,6 +335,7 @@
load: this.load, load: this.load,
currentNodeKey: this.currentNodeKey, currentNodeKey: this.currentNodeKey,
checkStrictly: this.checkStrictly, checkStrictly: this.checkStrictly,
filterCheckStrictly: this.filterCheckStrictly,
checkDescendants: this.checkDescendants, checkDescendants: this.checkDescendants,
defaultCheckedKeys: this.defaultCheckedKeys, defaultCheckedKeys: this.defaultCheckedKeys,
defaultExpandedKeys: this.defaultExpandedKeys, defaultExpandedKeys: this.defaultExpandedKeys,