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
|
@@ -1,225 +1,267 @@
|
|
|
1
1
|
@import '../../styles/var.less';
|
|
2
|
+
|
|
2
3
|
.k-tree {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.k-checkbox-wrapper {
|
|
13
|
-
margin-right: 4px;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
.k-tree-children {
|
|
17
|
-
margin: 0;
|
|
18
|
-
.k-tree-item-children {
|
|
19
|
-
margin: 0 0 0 12px;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
.k-tree-commes {
|
|
23
|
-
display: inline-block;
|
|
24
|
-
width: 24px;
|
|
25
|
-
position: relative;
|
|
26
|
-
height: 24px;
|
|
27
|
-
}
|
|
28
|
-
.k-checkbox-wp {
|
|
29
|
-
margin: 0;
|
|
30
|
-
}
|
|
31
|
-
.k-tree-icon {
|
|
32
|
-
margin-right: 5px;
|
|
33
|
-
vertical-align: middle;
|
|
34
|
-
font-size: 14px;
|
|
35
|
-
}
|
|
36
|
-
.k-tree-title {
|
|
37
|
-
display: inline-flex;
|
|
38
|
-
padding: 4px 4px;
|
|
39
|
-
align-items: center;
|
|
40
|
-
// margin: 0 4px;
|
|
41
|
-
z-index: 0;
|
|
42
|
-
border-radius: 2px;
|
|
43
|
-
cursor: pointer;
|
|
44
|
-
color: var(--kui-color-font);
|
|
4
|
+
.k-tree-item {
|
|
5
|
+
padding-bottom: 4px;
|
|
6
|
+
margin: 0;
|
|
7
|
+
list-style: none;
|
|
8
|
+
white-space: nowrap;
|
|
9
|
+
outline: 0;
|
|
10
|
+
user-select: none;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
45
13
|
line-height: 1;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
14
|
+
.k-checkbox {
|
|
15
|
+
margin-right: 4px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// .k-tree-children {
|
|
20
|
+
// // margin: 0;
|
|
21
|
+
// .k-tree-item-children {
|
|
22
|
+
// // margin: 0 0 0 24px;
|
|
23
|
+
// position: relative;
|
|
24
|
+
// }
|
|
25
|
+
// }
|
|
26
|
+
.k-tree-commes {
|
|
27
|
+
display: inline-block;
|
|
28
|
+
width: 24px;
|
|
29
|
+
position: relative;
|
|
30
|
+
height: 24px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// .k-checkbox-wp {
|
|
34
|
+
// margin: 0;
|
|
35
|
+
// }
|
|
36
|
+
.k-tree-icon {
|
|
37
|
+
margin-right: 5px;
|
|
38
|
+
vertical-align: middle;
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.k-tree-title {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
padding: 0 4px;
|
|
45
|
+
align-items: center;
|
|
46
|
+
// margin: 0 4px;
|
|
47
|
+
z-index: 0;
|
|
48
|
+
border-radius: @radius;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
color: var(--kui-color-font);
|
|
51
|
+
line-height: 1;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
text-overflow: ellipsis;
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
min-height: 24px;
|
|
56
|
+
// transition: all .2s ease-in-out;
|
|
57
|
+
&:hover {
|
|
58
|
+
background: var(--kui-color-hover);
|
|
59
|
+
outline: none;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.k-tree-item-drop {
|
|
64
|
+
>.k-tree-title {
|
|
65
|
+
background-color: var(--kui-color-main) !important;
|
|
66
|
+
color: #fff;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.k-tree-item-drag {
|
|
71
|
+
>.k-tree-title {
|
|
72
|
+
// background-color: tint(var(--kui-color-main), 90%) !important;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.k-tree-item-extra {
|
|
77
|
+
flex: 1;
|
|
78
|
+
text-align: right;
|
|
79
|
+
z-index: 1;
|
|
80
|
+
padding-right: 4px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.k-tree-item-extra-hidden {
|
|
84
|
+
.k-tree-item-extra {
|
|
85
|
+
display: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&:hover {
|
|
89
|
+
.k-tree-item-extra {
|
|
90
|
+
display: block;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.k-tree-item-disabled {
|
|
96
|
+
|
|
97
|
+
.k-tree-title,
|
|
98
|
+
.k-tree-icon {
|
|
99
|
+
color: var(--kui-color-disable-color);
|
|
100
|
+
cursor: not-allowed;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.k-tree-title {
|
|
104
|
+
|
|
105
|
+
&:hover,
|
|
106
|
+
&:focus {
|
|
107
|
+
background-color: transparent;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.k-tree-title-selected {
|
|
113
|
+
background: var(--kui-color-selected);
|
|
114
|
+
|
|
115
|
+
&:hover {
|
|
116
|
+
background: var(--kui-color-selected);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.k-tree-arrow {
|
|
121
|
+
font-size: 14px;
|
|
122
|
+
width: 24px;
|
|
123
|
+
height: 24px;
|
|
124
|
+
position: relative;
|
|
125
|
+
// text-align: center;
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
// transform: rotate(90deg);
|
|
130
|
+
// transition: all .2s ease-in-out;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
|
|
133
|
+
// background-color: #fff;
|
|
134
|
+
.k-icon {
|
|
135
|
+
transition: all .2s ease-in-out;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.k-tree-arrow-open .k-icon {
|
|
140
|
+
transform: rotate(90deg)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.k-tree-children {
|
|
144
|
+
// overflow: hidden;
|
|
145
|
+
transition: all .2s ease-in-out;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.tree-nodata {
|
|
149
|
+
padding: 8px 10px;
|
|
150
|
+
display: block;
|
|
151
|
+
color: var(--kui-color-disable-color);
|
|
152
|
+
font-size: 12px;
|
|
153
|
+
}
|
|
126
154
|
}
|
|
127
155
|
|
|
128
156
|
.k-tree-directory {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
157
|
+
position: relative;
|
|
158
|
+
|
|
159
|
+
.k-tree-title {
|
|
160
|
+
|
|
161
|
+
&:hover,
|
|
162
|
+
&:focus {
|
|
163
|
+
background-color: transparent;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.k-tree-item {
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
position: relative;
|
|
170
|
+
|
|
171
|
+
&::before {
|
|
172
|
+
content: '';
|
|
173
|
+
position: absolute;
|
|
174
|
+
left: 0;
|
|
175
|
+
top: 0;
|
|
176
|
+
width: 100%;
|
|
177
|
+
height: 24px;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.k-tree-item:hover::before {
|
|
182
|
+
background-color: var(--kui-color-hover);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.k-tree-item-selected,
|
|
186
|
+
.k-tree-item-selected:hover {
|
|
187
|
+
&::before {
|
|
188
|
+
color: #fff;
|
|
189
|
+
background-color: var(--kui-color-main);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.k-tree-title ,.k-icon {
|
|
193
|
+
background-color: transparent;
|
|
194
|
+
color: #fff;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.k-tree-item-disabled:hover {
|
|
199
|
+
cursor: not-allowed;
|
|
200
|
+
|
|
201
|
+
.k-tree-title {
|
|
202
|
+
color: var(--kui-color-disable-color);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&::before {
|
|
206
|
+
display: none;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
172
209
|
}
|
|
173
210
|
|
|
174
211
|
.k-tree-show-line {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
212
|
+
.k-tree-arrow {
|
|
213
|
+
transform: rotate(90deg);
|
|
214
|
+
|
|
215
|
+
.k-icon {
|
|
216
|
+
font-size: 16px;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.k-tree-item-children {
|
|
221
|
+
position: relative;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.k-tree-line {
|
|
225
|
+
border-left: 1px solid var(--kui-color-border);
|
|
226
|
+
position: absolute;
|
|
227
|
+
height: 100%;
|
|
228
|
+
z-index: 1;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.k-tree-commes {
|
|
232
|
+
&::before {
|
|
233
|
+
content: '';
|
|
234
|
+
position: absolute;
|
|
235
|
+
left: 12px;
|
|
236
|
+
top: 0;
|
|
237
|
+
width: 1px;
|
|
238
|
+
height: 28px;
|
|
239
|
+
background-color: var(--kui-color-border);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
&::after {
|
|
243
|
+
content: '';
|
|
244
|
+
position: absolute;
|
|
245
|
+
left: 12px;
|
|
246
|
+
top: 12px;
|
|
247
|
+
width: 12px;
|
|
248
|
+
height: 1px;
|
|
249
|
+
background-color: var(--kui-color-border);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
.k-tree-children:last-child {
|
|
255
|
+
|
|
256
|
+
>.k-tree-item>.k-tree-commes::before {
|
|
257
|
+
height: 12px;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
>.k-tree-item-children {
|
|
261
|
+
>.k-tree-line {
|
|
262
|
+
display: none;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
}
|
|
225
267
|
}
|
package/components/tree/tree.jsx
CHANGED
|
@@ -7,12 +7,15 @@ export default {
|
|
|
7
7
|
data: Array,
|
|
8
8
|
selectedKeys: Array,
|
|
9
9
|
expandedKeys: Array,
|
|
10
|
+
expandedAll: Boolean,
|
|
10
11
|
checkedKeys: Array,
|
|
11
12
|
checkable: Boolean,
|
|
12
13
|
draggable: Boolean,
|
|
13
14
|
showLine: Boolean,
|
|
14
15
|
showIcon: { type: Boolean, default: true },
|
|
15
16
|
showExtra: { type: Boolean, default: false },
|
|
17
|
+
multiple: { type: Boolean, default: false },
|
|
18
|
+
checkStrictly: Boolean,
|
|
16
19
|
directory: Boolean,
|
|
17
20
|
},
|
|
18
21
|
provide() {
|
|
@@ -53,11 +56,30 @@ export default {
|
|
|
53
56
|
// });
|
|
54
57
|
//Init half check
|
|
55
58
|
this.setCheckHalf()
|
|
56
|
-
},
|
|
57
59
|
|
|
60
|
+
},
|
|
61
|
+
mounted() {
|
|
62
|
+
window.addEventListener('keydown', this.handleKeyDown);
|
|
63
|
+
},
|
|
64
|
+
beforeDestroy() {
|
|
65
|
+
window.removeEventListener('keydown', this.handleKeyDown);
|
|
66
|
+
window.removeEventListener('keyup', this.handleKeyUp);
|
|
67
|
+
},
|
|
58
68
|
methods: {
|
|
69
|
+
handleKeyDown(event) {
|
|
70
|
+
// console.log(event)
|
|
71
|
+
if (event.ctrlKe || event.metaKey) {
|
|
72
|
+
this.ctrlKeyEntered = true;
|
|
73
|
+
}
|
|
74
|
+
window.addEventListener('keyup', this.handleKeyUp);
|
|
75
|
+
},
|
|
76
|
+
handleKeyUp(event) {
|
|
77
|
+
if (!event.ctrlKey && event.metaKey) {
|
|
78
|
+
this.ctrlKeyEntered = false;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
59
81
|
setCheckHalf() {
|
|
60
|
-
this.checkable && (this.defaultCheckedKeys || []).forEach(key => {
|
|
82
|
+
this.checkable && !this.checkStrictly && (this.defaultCheckedKeys || []).forEach(key => {
|
|
61
83
|
this.setParentHalf(this.defaultData, key)
|
|
62
84
|
})
|
|
63
85
|
},
|
|
@@ -91,13 +113,22 @@ export default {
|
|
|
91
113
|
})
|
|
92
114
|
},
|
|
93
115
|
onSelect(key, node) {
|
|
94
|
-
let { defaultSelectedKeys, ctrlKeyEntered } = this
|
|
116
|
+
let { defaultSelectedKeys, ctrlKeyEntered, multiple } = this
|
|
95
117
|
let index = defaultSelectedKeys.indexOf(key)
|
|
96
|
-
if (
|
|
97
|
-
|
|
118
|
+
if (multiple) {
|
|
119
|
+
if (ctrlKeyEntered) {
|
|
120
|
+
index > -1 ? defaultSelectedKeys.splice(index, 1) : defaultSelectedKeys.push(key)
|
|
121
|
+
} else {
|
|
122
|
+
index > -1 ? defaultSelectedKeys.splice(index, 1) : defaultSelectedKeys.push(key)
|
|
123
|
+
}
|
|
98
124
|
} else {
|
|
99
125
|
defaultSelectedKeys = index > -1 ? [] : [key]
|
|
100
126
|
}
|
|
127
|
+
// if (ctrlKeyEntered) {
|
|
128
|
+
// index > -1 ? defaultSelectedKeys.splice(index, 1) : defaultSelectedKeys.push(key)
|
|
129
|
+
// } else {
|
|
130
|
+
// defaultSelectedKeys = index > -1 ? [] : [key]
|
|
131
|
+
// }
|
|
101
132
|
this.defaultSelectedKeys = defaultSelectedKeys
|
|
102
133
|
this.$emit('select', {
|
|
103
134
|
selectedKeys: defaultSelectedKeys,
|
|
@@ -106,6 +137,8 @@ export default {
|
|
|
106
137
|
})
|
|
107
138
|
},
|
|
108
139
|
onExpand(key, item, vnode) {
|
|
140
|
+
let hasLoad = 'loadData' in this.$listeners || 'load-data' in this.$listeners
|
|
141
|
+
|
|
109
142
|
if (item.children && item.children.length) {
|
|
110
143
|
let { defaultExpandedKeys } = this
|
|
111
144
|
let index = defaultExpandedKeys.indexOf(key)
|
|
@@ -118,7 +151,7 @@ export default {
|
|
|
118
151
|
node: item,
|
|
119
152
|
vnode
|
|
120
153
|
})
|
|
121
|
-
} else if (
|
|
154
|
+
} else if (hasLoad && !item.isLeaf && !vnode.loading) {
|
|
122
155
|
vnode.loading = true
|
|
123
156
|
this.$emit('load-data', item, child => {
|
|
124
157
|
vnode.loading = false
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
#### 基础用法
|
|
3
|
+
最简单的用法。
|
|
4
|
+
</cn>
|
|
5
|
+
|
|
6
|
+
```vue
|
|
7
|
+
<template>
|
|
8
|
+
<TreeSelect v-model="value" :tree-data="data" tree-show-line :treeExpandedKeys="expandedKeys" :width="300" filterable/>
|
|
9
|
+
</template>
|
|
10
|
+
<script>
|
|
11
|
+
export default{
|
|
12
|
+
data() {
|
|
13
|
+
return {
|
|
14
|
+
expandedKeys:['0-1','1-1','1-1-2','1-2'],
|
|
15
|
+
value:'',
|
|
16
|
+
data: [
|
|
17
|
+
{
|
|
18
|
+
title: 'tree 1',
|
|
19
|
+
key: '0-1',
|
|
20
|
+
children: [
|
|
21
|
+
{
|
|
22
|
+
title: 'tree 1-1',
|
|
23
|
+
key: '1-1',
|
|
24
|
+
disabled: true,
|
|
25
|
+
children: [
|
|
26
|
+
{ title: 'leaf 1-1-1', disabled: true },
|
|
27
|
+
{
|
|
28
|
+
title: 'leaf 1-1-2',
|
|
29
|
+
key: '1-1-2',
|
|
30
|
+
children: [
|
|
31
|
+
{ title: 'leaf 1-1-2-1' },
|
|
32
|
+
{ title: 'leaf 1-1-2-2' }
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
title: 'tree 1-2',
|
|
39
|
+
key: '1-2',
|
|
40
|
+
children: [
|
|
41
|
+
{ title: 'leaf 1-2-1' },
|
|
42
|
+
{ title: 'leaf 1-2-2' }
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
title: 'tree 1-3',
|
|
47
|
+
children: [
|
|
48
|
+
{ title: 'leaf 1-3-1' },
|
|
49
|
+
{ title: 'leaf 1-3-2' }
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
59
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
#### 可勾选
|
|
3
|
+
使用勾选框实现多选功能。
|
|
4
|
+
</cn>
|
|
5
|
+
|
|
6
|
+
```vue
|
|
7
|
+
<template>
|
|
8
|
+
<TreeSelect v-model="value" :tree-data="data" :treeExpandedKeys="expandedKeys" multiple tree-checkable :width="300" />
|
|
9
|
+
</template>
|
|
10
|
+
<script>
|
|
11
|
+
export default{
|
|
12
|
+
data() {
|
|
13
|
+
return {
|
|
14
|
+
expandedKeys:['0-1','1-1','1-1-2','1-2'],
|
|
15
|
+
value:[],
|
|
16
|
+
data: [
|
|
17
|
+
{
|
|
18
|
+
title: 'tree 1',
|
|
19
|
+
key: '0-1',
|
|
20
|
+
children: [
|
|
21
|
+
{
|
|
22
|
+
title: 'tree 1-1',
|
|
23
|
+
key: '1-1',
|
|
24
|
+
disabled: true,
|
|
25
|
+
children: [
|
|
26
|
+
{ title: 'leaf 1-1-1', disabled: true },
|
|
27
|
+
{
|
|
28
|
+
title: 'leaf 1-1-2',
|
|
29
|
+
key: '1-1-2',
|
|
30
|
+
children: [
|
|
31
|
+
{ title: 'leaf 1-1-2-1' },
|
|
32
|
+
{ title: 'leaf 1-1-2-2' }
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
title: 'tree 1-2',
|
|
39
|
+
key: '1-2',
|
|
40
|
+
children: [
|
|
41
|
+
{ title: 'leaf 1-2-1' },
|
|
42
|
+
{ title: 'leaf 1-2-2' }
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
title: 'tree 1-3',
|
|
47
|
+
children: [
|
|
48
|
+
{ title: 'leaf 1-3-1' },
|
|
49
|
+
{ title: 'leaf 1-3-2' }
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
59
|
+
```
|