kui-vue 3.4.6 → 3.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/_tool/clone.js +1 -0
- package/components/avatar/demo/base.md +13 -15
- package/components/avatar/demo/change.md +2 -2
- package/components/avatar/demo/index.vue +1 -8
- package/components/avatar/demo/types.md +2 -2
- package/components/badge/badge.jsx +1 -0
- package/components/badge/demo/base.md +5 -5
- package/components/badge/demo/dot.md +1 -12
- package/components/badge/demo/dynamic.md +0 -11
- package/components/badge/demo/index.vue +14 -2
- package/components/badge/demo/mark.md +3 -3
- package/components/badge/demo/max.md +0 -12
- package/components/badge/demo/status.md +0 -5
- package/components/badge/styles/index.less +29 -2
- package/components/base/input.jsx +53 -27
- package/components/button/styles/index.less +4 -1
- package/components/checkbox/checkbox.jsx +1 -1
- package/components/checkbox/styles/index.less +13 -1
- package/components/colorPicker/colorpicker.jsx +59 -35
- package/components/colorPicker/demo/shape.md +1 -0
- package/components/colorPicker/index.md +1 -0
- package/components/colorPicker/styles/index.less +68 -56
- package/components/datePicker/datepicker.jsx +2 -1
- package/components/datePicker/demo/base.md +0 -3
- package/components/drawer/drawer.jsx +1 -1
- package/components/form/demo/base.md +19 -2
- package/components/form/demo/length.md +1 -1
- package/components/form/demo/valid.md +21 -6
- package/components/form/form.jsx +4 -2
- package/components/form/formitem.jsx +3 -1
- package/components/form/styles/index.less +4 -2
- package/components/index.js +2 -0
- package/components/input/demo/base.md +2 -2
- package/components/input/demo/event.md +2 -2
- package/components/input/demo/group.md +20 -3
- package/components/input/demo/icon.md +8 -2
- package/components/input/demo/index.vue +1 -15
- package/components/input/demo/size.md +2 -2
- package/components/input/demo/suffix.md +63 -29
- package/components/input/demo/textarea.md +2 -2
- package/components/input/demo/theme.md +2 -4
- package/components/input/index.md +20 -10
- package/components/input/input.jsx +3 -0
- package/components/input/inputGroup.jsx +7 -4
- package/components/input/styles/index.less +104 -2
- package/components/input/textarea.jsx +1 -0
- package/components/inputNumber/demo/base.md +6 -12
- package/components/inputNumber/demo/ffix.md +3 -9
- package/components/inputNumber/inputNumber.jsx +9 -5
- package/components/inputNumber/styles/index.less +34 -20
- package/components/menu/styles/index.less +1 -1
- package/components/message/demo/index.vue +1 -10
- package/components/message/demo/types.md +3 -3
- package/components/modal/demo/base.md +2 -2
- package/components/modal/demo/confrim.md +2 -2
- package/components/modal/demo/custom.md +2 -2
- package/components/modal/demo/global.md +2 -2
- package/components/modal/demo/index.vue +1 -10
- package/components/modal/demo/more.md +2 -2
- package/components/notice/demo/close.md +2 -2
- package/components/notice/demo/icon.md +2 -2
- package/components/notice/demo/index.vue +1 -10
- package/components/notice/demo/types.md +4 -4
- package/components/popconfirm/demo/index.vue +1 -10
- package/components/popconfirm/demo/local.md +17 -15
- package/components/popconfirm/demo/placement.md +50 -46
- package/components/poptip/demo/base.md +16 -14
- package/components/poptip/demo/index.vue +1 -10
- package/components/poptip/demo/placement.md +99 -94
- package/components/poptip/demo/trigger.md +16 -14
- package/components/rate/demo/base.md +2 -5
- package/components/rate/demo/character.md +2 -4
- package/components/rate/demo/clear.md +2 -3
- package/components/rate/demo/custom.md +3 -5
- package/components/rate/demo/disabled.md +4 -8
- package/components/rate/demo/tips.md +2 -2
- package/components/select/styles/index.less +5 -1
- package/components/space/demo/compact.md +23 -6
- package/components/space/space.jsx +21 -24
- package/components/space/styles/index.less +5 -0
- package/components/styles/index.less +1 -0
- package/components/tooltip/demo/index.vue +1 -14
- package/components/tooltip/demo/placement.md +50 -46
- package/components/tree/demo/checkable.md +5 -1
- package/components/tree/demo/directory.md +27 -31
- package/components/tree/index.md +22 -15
- package/components/tree/node.jsx +43 -23
- package/components/tree/styles/index.less +257 -215
- package/components/tree/tree.jsx +39 -6
- package/components/treeselect/demo/base.md +59 -0
- package/components/treeselect/demo/checkable.md +59 -0
- package/components/treeselect/demo/index.vue +30 -0
- package/components/treeselect/demo/info.md +7 -0
- package/components/treeselect/demo/multiple.md +59 -0
- package/components/treeselect/demo/sync.md +38 -0
- package/components/treeselect/index.md +38 -0
- package/components/treeselect/styles/index.less +579 -27
- package/components/treeselect/treeselect.jsx +508 -0
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.js +2 -2
- package/package.json +2 -1
- package/components/treeselect/treeselect.vue +0 -200
|
@@ -52,36 +52,33 @@ export default {
|
|
|
52
52
|
}
|
|
53
53
|
let childs = $slots.default
|
|
54
54
|
let split = $slots.split
|
|
55
|
-
if (compact) {
|
|
56
|
-
childs = getChild(this.$slots.default)
|
|
57
|
-
let newChilds = []
|
|
58
|
-
for (let i = 0; i < childs.length; i++) {
|
|
59
|
-
let pre = vertical ? 'vertical-' : ''
|
|
60
|
-
let child = cloneVNode(childs[i], {
|
|
61
|
-
props: {
|
|
62
|
-
size
|
|
63
|
-
},
|
|
64
|
-
class: {
|
|
65
|
-
[`k-space-${pre}first-item`]: i == 0,
|
|
66
|
-
[`k-space-${pre}item`]: i > 0 && i < childs.length - 1,
|
|
67
|
-
[`k-space-${pre}last-item`]: i == childs.length - 1,
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
newChilds.push(child)
|
|
71
|
-
}
|
|
72
|
-
childs = newChilds
|
|
73
55
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
56
|
+
childs = getChild(this.$slots.default)
|
|
57
|
+
let newChilds = []
|
|
58
|
+
|
|
59
|
+
for (let i = 0; i < childs.length; i++) {
|
|
60
|
+
let pre = vertical ? 'vertical-' : ''
|
|
61
|
+
let p = {
|
|
62
|
+
props: {
|
|
63
|
+
size
|
|
64
|
+
},
|
|
65
|
+
class: {
|
|
66
|
+
[`k-space-${pre}first-item`]: i == 0,
|
|
67
|
+
[`k-space-${pre}item`]: i > 0 && i < childs.length - 1,
|
|
68
|
+
[`k-space-${pre}last-item`]: i == childs.length - 1,
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
let child = compact ? cloneVNode(childs[i], p) : <div {...p}>{childs[i]}</div>
|
|
72
|
+
// let child = cloneVNode(childs[i], p)
|
|
73
|
+
newChilds.push(child)
|
|
74
|
+
if (split) {
|
|
79
75
|
if (i < childs.length - 1) {
|
|
80
76
|
newChilds.push(split)
|
|
81
77
|
}
|
|
82
78
|
}
|
|
83
|
-
childs = newChilds
|
|
84
79
|
}
|
|
80
|
+
childs = newChilds
|
|
81
|
+
|
|
85
82
|
return <div {...props}>{childs}</div>
|
|
86
83
|
}
|
|
87
84
|
}
|
|
@@ -17,17 +17,4 @@ export default {
|
|
|
17
17
|
)
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
</script>
|
|
21
|
-
<style lang="less">
|
|
22
|
-
.demo-tooltip {
|
|
23
|
-
.k-btn {
|
|
24
|
-
margin-right: 10px;
|
|
25
|
-
margin-bottom: 10px;
|
|
26
|
-
min-width: 70px;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
.demo-tooltip-color .k-btn {
|
|
30
|
-
margin:0 8px 8px 0;
|
|
31
|
-
min-width: auto;
|
|
32
|
-
}
|
|
33
|
-
</style>
|
|
20
|
+
</script>
|
|
@@ -5,56 +5,60 @@
|
|
|
5
5
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
8
|
+
<Flex style="width:300px" vertical align="center">
|
|
9
|
+
<Space compact>
|
|
10
|
+
<Tooltip placement="top-left" :title="title">
|
|
11
|
+
<Button>TL</Button>
|
|
12
|
+
</Tooltip>
|
|
13
|
+
<Tooltip placement="top" :title="title">
|
|
14
|
+
<Button>Top</Button>
|
|
15
|
+
</Tooltip>
|
|
16
|
+
<Tooltip placement="top-right" :title="title">
|
|
17
|
+
<Button>TR</Button>
|
|
18
|
+
</Tooltip>
|
|
19
|
+
</Space>
|
|
20
|
+
<Flex justify="space-between" style="width:100%;padding:10px 0">
|
|
21
|
+
<Space vertical compact>
|
|
22
|
+
<Tooltip placement="left-top" :title="title">
|
|
23
|
+
<Button>LT</Button>
|
|
24
|
+
</Tooltip>
|
|
25
|
+
<Tooltip placement="left" :title="title">
|
|
26
|
+
<Button>Left</Button>
|
|
27
|
+
</Tooltip>
|
|
28
|
+
<Tooltip placement="left-bottom" :title="title">
|
|
29
|
+
<Button>LB</Button>
|
|
30
|
+
</Tooltip>
|
|
31
|
+
</Space>
|
|
32
|
+
<Space vertical compact>
|
|
33
|
+
<Tooltip placement="right-top" :title="title">
|
|
34
|
+
<Button>RT</Button>
|
|
35
|
+
</Tooltip>
|
|
36
|
+
<Tooltip placement="right" :title="title">
|
|
37
|
+
<Button>Right</Button>
|
|
38
|
+
</Tooltip>
|
|
39
|
+
<Tooltip placement="right-bottom" :title="title">
|
|
40
|
+
<Button>RB</Button>
|
|
41
|
+
</Tooltip>
|
|
42
|
+
</Space>
|
|
43
|
+
</Flex>
|
|
44
|
+
<Space compact>
|
|
45
|
+
<Tooltip placement="bottom-left" :title="title">
|
|
46
|
+
<Button>BL</Button>
|
|
47
|
+
</Tooltip>
|
|
48
|
+
<Tooltip placement="bottom" :title="title">
|
|
49
|
+
<Button>Bottom</Button>
|
|
50
|
+
</Tooltip>
|
|
51
|
+
<Tooltip placement="bottom-right" :title="title">
|
|
52
|
+
<Button>BR</Button>
|
|
53
|
+
</Tooltip>
|
|
54
|
+
</Space>
|
|
55
|
+
</Flex>
|
|
52
56
|
</template>
|
|
53
57
|
<script>
|
|
54
|
-
export default{
|
|
58
|
+
export default {
|
|
55
59
|
data() {
|
|
56
60
|
return {
|
|
57
|
-
title:'明月几时有?',
|
|
61
|
+
title: '明月几时有?',
|
|
58
62
|
}
|
|
59
63
|
},
|
|
60
64
|
}
|
|
@@ -5,12 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
|
-
<
|
|
8
|
+
<Checkbox v-model="checkStrictly">父子节点不关联</Checkbox>
|
|
9
|
+
<br />
|
|
10
|
+
<br />
|
|
11
|
+
<Tree :data="data" checkable :checkedKeys="checkedKeys" :expandedKeys="expandedKeys" @check="check" :checkStrictly="checkStrictly"/>
|
|
9
12
|
</template>
|
|
10
13
|
<script>
|
|
11
14
|
export default {
|
|
12
15
|
data() {
|
|
13
16
|
return {
|
|
17
|
+
checkStrictly:false,
|
|
14
18
|
checkedKeys: ['1-1', 'aa', ],
|
|
15
19
|
expandedKeys: ['1-1', '1-1-2', '1-2', '0-1'],
|
|
16
20
|
data: [
|
|
@@ -6,39 +6,27 @@
|
|
|
6
6
|
```vue
|
|
7
7
|
<template>
|
|
8
8
|
<div>
|
|
9
|
-
<
|
|
10
|
-
label="Directory" />
|
|
11
|
-
|
|
12
|
-
label="
|
|
13
|
-
|
|
14
|
-
label="
|
|
15
|
-
|
|
16
|
-
label="
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<Checkbox v-model="showExtra"
|
|
20
|
-
label="ShowExtra" />
|
|
9
|
+
<Space>
|
|
10
|
+
<Checkbox v-model="directory" label="Directory" />
|
|
11
|
+
<Checkbox v-model="showLine" label="showLine" />
|
|
12
|
+
<Checkbox v-model="draggable" label="Draggable" />
|
|
13
|
+
<Checkbox v-model="checkable" label="Checkable" />
|
|
14
|
+
<Checkbox v-model="showIcon" label="ShowIcon" />
|
|
15
|
+
<Checkbox v-model="showExtra" label="ShowExtra" />
|
|
16
|
+
<Checkbox v-model="multiple" label="Multiple" />
|
|
17
|
+
<Checkbox v-model="checkStrictly" label="checkStrictly" />
|
|
18
|
+
</Space>
|
|
21
19
|
<br />
|
|
22
20
|
<br />
|
|
23
|
-
<Tree :data="data"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
:selectedKeys="selectedKeys"
|
|
33
|
-
:expandedKeys="expandedKeys">
|
|
34
|
-
<template v-slot:extra="{ node , parent}">
|
|
35
|
-
<Icon :type="Add"
|
|
36
|
-
@click="e=>append(e,node)" />
|
|
37
|
-
<Icon :type="Trash"
|
|
38
|
-
@click="e=>remove(e,node,parent)"
|
|
39
|
-
v-if="node.key!='0-0'" />
|
|
40
|
-
<Icon :type="IconEdit"
|
|
41
|
-
@click="e=>edit(e,node)" />
|
|
21
|
+
<Tree :data="data" style="width:512px" @expand="expand" :directory="directory" :draggable="draggable"
|
|
22
|
+
:checkable="checkable" :multiple="multiple" :show-line="showLine" :show-icon="showIcon" :show-extra="showExtra"
|
|
23
|
+
:selectedKeys="selectedKeys" :expandedKeys="expandedKeys" :checkStrictly="checkStrictly">
|
|
24
|
+
<template v-slot:extra="{ node, parent }">
|
|
25
|
+
<Space>
|
|
26
|
+
<Button size="small" theme="normal" :icon="Add" @click="e => append(e, node)" />
|
|
27
|
+
<Button size="small" theme="normal" :icon="Trash" @click="e => remove(e, node, parent)" v-if="node.key != '0-0'" />
|
|
28
|
+
<Button size="small" theme="normal" :icon="IconEdit" @click="e => edit(e, node)" />
|
|
29
|
+
</Space>
|
|
42
30
|
</template>
|
|
43
31
|
</Tree>
|
|
44
32
|
</div>
|
|
@@ -57,6 +45,9 @@ export default {
|
|
|
57
45
|
showExtra: true,
|
|
58
46
|
expandedKeys: ['0-0', '1-0', '1-1', '1-2'],
|
|
59
47
|
selectedKeys: ['0-0'],
|
|
48
|
+
checkStrictly:false,
|
|
49
|
+
multiple:false,
|
|
50
|
+
checkedKeys:[],
|
|
60
51
|
data: [
|
|
61
52
|
{
|
|
62
53
|
title: 'src',
|
|
@@ -91,6 +82,11 @@ export default {
|
|
|
91
82
|
]
|
|
92
83
|
}
|
|
93
84
|
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
title: 'src11',
|
|
88
|
+
key: '0-1',
|
|
89
|
+
icon: FolderOpenOutline,
|
|
94
90
|
}
|
|
95
91
|
],
|
|
96
92
|
}
|
package/components/tree/index.md
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
## Tree API
|
|
2
2
|
|
|
3
|
-
| 属性
|
|
4
|
-
|
|
5
|
-
| data
|
|
6
|
-
| checkable
|
|
7
|
-
| draggable
|
|
8
|
-
| show-line
|
|
9
|
-
| show-icon
|
|
10
|
-
| show-extra
|
|
3
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
4
|
+
| ------------- | ------------------------------------------------------------ | ------- | ------ |
|
|
5
|
+
| data | 可嵌套的节点属性的数组,生成 `tree` 的数据 | Array | [] |
|
|
6
|
+
| checkable | 是否显示多选框 | Boolean | false |
|
|
7
|
+
| draggable | 是否可以拖拽 | Boolean | false |
|
|
8
|
+
| show-line | 是否展示连接线 | Boolean | false |
|
|
9
|
+
| show-icon | 是否展示图标 | Boolean | true |
|
|
10
|
+
| show-extra | 是否默认展示扩展元素 | Boolean | false |
|
|
11
|
+
| checkStrictly | checkable 状态下节点选择完全受控(父子节点选中状态不再关联) | Boolean | false |
|
|
12
|
+
| checkedKeys | 选中复选框的树节点 | Array | [] |
|
|
13
|
+
| expandedKeys | 指定展开的节点 | Array | [] |
|
|
14
|
+
| expandedAll | 是否展开所有节点 | Boolean | false |
|
|
15
|
+
| selectedKeys | 选中的节点 | Array | [] |
|
|
16
|
+
| multiple | 是否支持多选 | Boolean | false |
|
|
11
17
|
|
|
12
18
|
## TreeNode API
|
|
13
19
|
|
|
14
|
-
| 属性 | 说明
|
|
15
|
-
|
|
16
|
-
| title | 节点标题
|
|
17
|
-
| icon | 自定义图标
|
|
18
|
-
| disabled | 是否禁用节点
|
|
19
|
-
| children | 子节点
|
|
20
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
21
|
+
| -------- | ------------------------------------------------------------------------ | ------- | ------ |
|
|
22
|
+
| title | 节点标题 | String | - |
|
|
23
|
+
| icon | 自定义图标 | String | - |
|
|
24
|
+
| disabled | 是否禁用节点 | Boolean | false |
|
|
25
|
+
| children | 子节点 | Array | - |
|
|
26
|
+
| isLeaf | 设置为叶子节点 (设置了 loadData 时有效)。为 false 时会强制将其作为父节点 | Boolean | false |
|
|
20
27
|
|
|
21
28
|
## Tree 事件
|
|
22
29
|
| 属性 | 说明 | 回调参数 |
|
|
23
|
-
|
|
30
|
+
| --------- | ---------------------- | -------------------------------------------- |
|
|
24
31
|
| load-data | 异步加载数据的方法 | Function(node,callback) |
|
|
25
32
|
| select | 点击树节点时触发 | Function({selectedKeys,selected,node,vnode}) |
|
|
26
33
|
| check | 点击复选框时触发 | Function({checkedKeys,checked,node,vnode}) |
|
package/components/tree/node.jsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import Icon from '../icon'
|
|
2
2
|
import { Checkbox } from '../checkbox'
|
|
3
|
+
import { Button } from '../button'
|
|
3
4
|
import Node from './node.jsx'
|
|
4
5
|
import { getTranstionProp } from '../base/transition'
|
|
5
6
|
import { getChild } from '../_tool/utils'
|
|
6
7
|
import cloneVNode from '../_tool/clone.js'
|
|
7
|
-
import { Sync, RemoveCircleOutline, AddCircleOutline,
|
|
8
|
+
import { Sync, RemoveCircleOutline, AddCircleOutline, ChevronForward } from 'kui-icons'
|
|
8
9
|
export default {
|
|
9
10
|
name: 'TreeNode',
|
|
10
11
|
props: {
|
|
@@ -26,6 +27,7 @@ export default {
|
|
|
26
27
|
draged: false,
|
|
27
28
|
droped: false,
|
|
28
29
|
reload: true,
|
|
30
|
+
level: 0
|
|
29
31
|
}
|
|
30
32
|
},
|
|
31
33
|
watch: {
|
|
@@ -38,12 +40,16 @@ export default {
|
|
|
38
40
|
VNode: { default: null },
|
|
39
41
|
},
|
|
40
42
|
created() {
|
|
41
|
-
let { defaultCheckedKeys = [], draggable } = this.Tree
|
|
43
|
+
let { defaultCheckedKeys = [], draggable, checkStrictly } = this.Tree
|
|
42
44
|
let checked = defaultCheckedKeys.indexOf(this.$vnode.key) > -1
|
|
43
|
-
if (checked) {
|
|
45
|
+
if (checked && !checkStrictly) {
|
|
44
46
|
this.updateChildCheck(this.defaultData, checked)
|
|
45
|
-
if (this.VNode)
|
|
47
|
+
if (this.VNode) {
|
|
46
48
|
this.updateParentCheck(this.VNode)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (this.VNode) {
|
|
52
|
+
this.level = this.VNode.level + 1
|
|
47
53
|
}
|
|
48
54
|
},
|
|
49
55
|
beforeDestroy() {
|
|
@@ -68,11 +74,12 @@ export default {
|
|
|
68
74
|
if (!item.disabled) {
|
|
69
75
|
let { defaultCheckedKeys } = this.Tree
|
|
70
76
|
const key = item.key
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
if (key !== undefined) {
|
|
78
|
+
let index = defaultCheckedKeys.indexOf(key)
|
|
79
|
+
checked ? index < 0 && defaultCheckedKeys.push(key) : index > -1 && defaultCheckedKeys.splice(index, 1)
|
|
80
|
+
this.Tree.defaultCheckedKeys = defaultCheckedKeys
|
|
81
|
+
this.updateChildCheck(item, checked)
|
|
82
|
+
}
|
|
76
83
|
}
|
|
77
84
|
})
|
|
78
85
|
},
|
|
@@ -102,7 +109,7 @@ export default {
|
|
|
102
109
|
let { Tree } = this
|
|
103
110
|
let key = this.$vnode.key
|
|
104
111
|
|
|
105
|
-
let { defaultCheckedKeys, halfCheckedKeys } = this.Tree
|
|
112
|
+
let { defaultCheckedKeys, halfCheckedKeys, checkStrictly } = this.Tree
|
|
106
113
|
let index = defaultCheckedKeys.indexOf(key)
|
|
107
114
|
checked && index < 0 ? defaultCheckedKeys.push(key) : defaultCheckedKeys.splice(index, 1)
|
|
108
115
|
this.Tree.defaultCheckedKeys = defaultCheckedKeys
|
|
@@ -113,21 +120,25 @@ export default {
|
|
|
113
120
|
halfCheckedKeys.splice(halfIndex, 1)
|
|
114
121
|
}
|
|
115
122
|
|
|
116
|
-
|
|
117
|
-
|
|
123
|
+
|
|
124
|
+
if (!checkStrictly) {
|
|
125
|
+
// update child
|
|
126
|
+
this.updateChildCheck(this.defaultData, checked)
|
|
127
|
+
|
|
128
|
+
// update parent
|
|
129
|
+
this.VNode && this.updateParentCheck(this.VNode)
|
|
130
|
+
}
|
|
118
131
|
Tree.onCheck(e.target.checked, key, this.defaultData, this)
|
|
119
132
|
}
|
|
120
133
|
},
|
|
121
134
|
handleSelect(e) {
|
|
122
135
|
let { disabled, key } = this.defaultData
|
|
123
136
|
if (!disabled) {
|
|
124
|
-
let { Tree } = this
|
|
137
|
+
let { Tree, multiple } = this
|
|
125
138
|
if (Tree.directory) {
|
|
126
139
|
this.handleExpand(e)
|
|
127
140
|
}
|
|
128
|
-
|
|
129
|
-
Tree.onSelect(key, this.defaultData, this)
|
|
130
|
-
}
|
|
141
|
+
Tree.onSelect(key, this.defaultData, this)
|
|
131
142
|
}
|
|
132
143
|
},
|
|
133
144
|
handleExpand(e) {
|
|
@@ -185,26 +196,28 @@ export default {
|
|
|
185
196
|
let itemNode = [], { Tree, loading, reload } = this;
|
|
186
197
|
let key = this.$vnode.key
|
|
187
198
|
let { defaultSelectedKeys = [], defaultExpandedKeys = [], defaultCheckedKeys = [], halfCheckedKeys = [],
|
|
188
|
-
checkable, showLine, directory, draggable, showIcon, showExtra } = Tree
|
|
189
|
-
const expand = defaultExpandedKeys.indexOf(key) > - 1,
|
|
199
|
+
checkable, showLine, directory, draggable, showIcon, showExtra, expandedAll } = Tree
|
|
200
|
+
const expand = expandedAll || defaultExpandedKeys.indexOf(key) > - 1,
|
|
190
201
|
selected = defaultSelectedKeys.indexOf(key) > - 1,
|
|
191
202
|
checked = defaultCheckedKeys.indexOf(key) > - 1,
|
|
192
203
|
indeterminate = halfCheckedKeys.indexOf(key) > - 1;
|
|
193
204
|
|
|
194
205
|
let hasChilds = slotChilds.length > 0 || children.length > 0
|
|
195
|
-
|
|
206
|
+
let hasLoad = 'loadData' in Tree.$listeners || 'load-data' in Tree.$listeners
|
|
207
|
+
if ((hasChilds || hasLoad) && isLeaf !== true) {
|
|
196
208
|
let arrowCls = ['k-tree-arrow', { 'k-tree-arrow-open': expand }]
|
|
197
209
|
let arrowNode = <span class={arrowCls} onClick={this.handleExpand}>
|
|
198
|
-
<
|
|
210
|
+
<Button size="small" theme="normal" loading={loading} icon={loading ? Sync : (showLine ? (expand ? RemoveCircleOutline : AddCircleOutline) : ChevronForward)} spin={loading} />
|
|
199
211
|
</span>
|
|
200
212
|
itemNode.push(arrowNode)
|
|
201
213
|
} else {
|
|
202
214
|
itemNode.push(<span class="k-tree-commes"></span>)
|
|
203
215
|
}
|
|
216
|
+
// console.log(checked,checked, disabled, indeterminate)
|
|
204
217
|
if (checkable) {
|
|
205
218
|
let props = {
|
|
206
219
|
props: { checked, disabled, indeterminate },
|
|
207
|
-
on: { change: this.handleCheck
|
|
220
|
+
on: { change: this.handleCheck }
|
|
208
221
|
}
|
|
209
222
|
itemNode.push(<Checkbox {...props} />)
|
|
210
223
|
}
|
|
@@ -255,6 +268,7 @@ export default {
|
|
|
255
268
|
childs = children.map((item, i) => {
|
|
256
269
|
const k = item.key || `${key}_${i}`
|
|
257
270
|
item.key = k
|
|
271
|
+
// console.log(k)
|
|
258
272
|
return <Node data={item} key={k} />
|
|
259
273
|
})
|
|
260
274
|
}
|
|
@@ -269,7 +283,10 @@ export default {
|
|
|
269
283
|
'k-tree-item-extra-hidden': !showExtra,
|
|
270
284
|
'k-tree-item-selected': directory && selected
|
|
271
285
|
}],
|
|
272
|
-
on: {}
|
|
286
|
+
on: {},
|
|
287
|
+
style: {
|
|
288
|
+
paddingLeft: `${(this.level || 0) * 24}px`
|
|
289
|
+
}
|
|
273
290
|
}
|
|
274
291
|
if (directory) {
|
|
275
292
|
itemProps.on.click = this.handleSelect
|
|
@@ -280,10 +297,13 @@ export default {
|
|
|
280
297
|
let extra = Tree.$scopedSlots.extra({ node: this.defaultData, parent: this.getParent() })
|
|
281
298
|
extraNode = <span class='k-tree-item-extra'>{extra}</span>
|
|
282
299
|
}
|
|
300
|
+
childs && childs.unshift(<span class="k-tree-line" style={{ left: `${(this.level || 0) * 24 + 12}px` }} key="line"></span>)
|
|
283
301
|
return (
|
|
284
302
|
<div class="k-tree-children">
|
|
285
303
|
<div {...itemProps}>{itemNode}{extraNode}</div>
|
|
286
|
-
|
|
304
|
+
{
|
|
305
|
+
<transition-group class="k-tree-item-children" tag="div" {...onProps}>{childs}</transition-group>
|
|
306
|
+
}
|
|
287
307
|
</div>)
|
|
288
308
|
}
|
|
289
309
|
}
|