@kdcloudjs/kdesign 1.5.3 → 1.5.6
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/CHANGELOG.md +61 -0
- package/dist/default-theme.js +4 -4
- package/dist/kdesign-complete.less +164 -88
- package/dist/kdesign.css +160 -86
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +392 -253
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +4 -4
- package/dist/kdesign.min.js +6 -6
- package/dist/kdesign.min.js.map +1 -1
- package/es/_utils/usePopper.js +79 -46
- package/es/alert/alert.js +2 -2
- package/es/alert/style/index.css +27 -11
- package/es/alert/style/index.less +24 -10
- package/es/alert/style/mixin.less +8 -2
- package/es/alert/style/token.less +16 -8
- package/es/config-provider/compDefaultProps.d.ts +1 -0
- package/es/config-provider/compDefaultProps.js +2 -1
- package/es/drawer/drawer.js +1 -0
- package/es/dropdown/dropdown.js +16 -6
- package/es/dropdown/style/index.css +13 -14
- package/es/dropdown/style/index.less +4 -5
- package/es/dropdown/style/token.less +6 -5
- package/es/radio/style/index.css +7 -1
- package/es/radio/style/index.less +9 -1
- package/es/search/style/index.css +3 -3
- package/es/select/select.js +1 -1
- package/es/spin/style/index.css +25 -26
- package/es/spin/style/index.less +18 -19
- package/es/spin/style/token.less +9 -3
- package/es/stepper/stepper.js +9 -4
- package/es/stepper/style/index.css +2 -0
- package/es/stepper/style/index.less +2 -0
- package/es/stepper/style/token.less +1 -2
- package/es/style/icon/kdicon.css +2 -1
- package/es/style/icon/kdicon.woff +0 -0
- package/es/style/themes/default.less +3 -4
- package/es/tabs/style/index.css +1 -0
- package/es/tabs/style/index.less +1 -0
- package/es/timeline/style/index.css +22 -21
- package/es/timeline/style/index.less +2 -2
- package/es/timeline/style/token.less +4 -7
- package/es/tooltip/tooltip.js +1 -1
- package/es/tree/style/index.css +56 -7
- package/es/tree/style/index.less +26 -18
- package/es/tree/style/mixin.less +25 -1
- package/es/tree/style/token.less +6 -4
- package/es/tree/tree.d.ts +2 -0
- package/es/tree/tree.js +77 -20
- package/es/tree/treeHooks.d.ts +1 -1
- package/es/tree/treeHooks.js +3 -4
- package/es/tree/treeNode.d.ts +1 -0
- package/es/tree/treeNode.js +45 -49
- package/es/tree/utils/treeUtils.d.ts +6 -3
- package/es/tree/utils/treeUtils.js +66 -42
- package/lib/_utils/usePopper.js +79 -46
- package/lib/alert/alert.js +2 -2
- package/lib/alert/style/index.css +27 -11
- package/lib/alert/style/index.less +24 -10
- package/lib/alert/style/mixin.less +8 -2
- package/lib/alert/style/token.less +16 -8
- package/lib/config-provider/compDefaultProps.d.ts +1 -0
- package/lib/config-provider/compDefaultProps.js +2 -1
- package/lib/drawer/drawer.js +1 -0
- package/lib/dropdown/dropdown.js +15 -6
- package/lib/dropdown/style/index.css +13 -14
- package/lib/dropdown/style/index.less +4 -5
- package/lib/dropdown/style/token.less +6 -5
- package/lib/radio/style/index.css +7 -1
- package/lib/radio/style/index.less +9 -1
- package/lib/search/style/index.css +3 -3
- package/lib/select/select.js +1 -1
- package/lib/spin/style/index.css +25 -26
- package/lib/spin/style/index.less +18 -19
- package/lib/spin/style/token.less +9 -3
- package/lib/stepper/stepper.js +9 -4
- package/lib/stepper/style/index.css +2 -0
- package/lib/stepper/style/index.less +2 -0
- package/lib/stepper/style/token.less +1 -2
- package/lib/style/icon/kdicon.css +2 -1
- package/lib/style/icon/kdicon.woff +0 -0
- package/lib/style/themes/default.less +3 -4
- package/lib/tabs/style/index.css +1 -0
- package/lib/tabs/style/index.less +1 -0
- package/lib/timeline/style/index.css +22 -21
- package/lib/timeline/style/index.less +2 -2
- package/lib/timeline/style/token.less +4 -7
- package/lib/tooltip/tooltip.js +1 -1
- package/lib/tree/style/index.css +56 -7
- package/lib/tree/style/index.less +26 -18
- package/lib/tree/style/mixin.less +25 -1
- package/lib/tree/style/token.less +6 -4
- package/lib/tree/tree.d.ts +2 -0
- package/lib/tree/tree.js +78 -20
- package/lib/tree/treeHooks.d.ts +1 -1
- package/lib/tree/treeHooks.js +3 -4
- package/lib/tree/treeNode.d.ts +1 -0
- package/lib/tree/treeNode.js +46 -48
- package/lib/tree/utils/treeUtils.d.ts +6 -3
- package/lib/tree/utils/treeUtils.js +64 -42
- package/package.json +1 -1
|
@@ -107,11 +107,12 @@
|
|
|
107
107
|
.kd-timeline {
|
|
108
108
|
-webkit-box-sizing: border-box;
|
|
109
109
|
box-sizing: border-box;
|
|
110
|
+
padding: 0;
|
|
110
111
|
font-variant: tabular-nums;
|
|
111
112
|
-webkit-font-feature-settings: 'tnum';
|
|
112
113
|
font-feature-settings: 'tnum';
|
|
113
114
|
margin: 0;
|
|
114
|
-
padding: 0;
|
|
115
|
+
padding: 0 4px;
|
|
115
116
|
overflow: hidden;
|
|
116
117
|
list-style: none;
|
|
117
118
|
}
|
|
@@ -125,13 +126,13 @@
|
|
|
125
126
|
font-feature-settings: 'tnum';
|
|
126
127
|
position: relative;
|
|
127
128
|
margin: 0;
|
|
128
|
-
padding-bottom: var(--kd-c-timeline-spacing-padding-bottom,
|
|
129
|
+
padding-bottom: var(--kd-c-timeline-spacing-padding-bottom, 24px);
|
|
129
130
|
font-size: var(--kd-c-timeline-content-font-size, var(--kd-g-font-size-small, 12px));
|
|
130
131
|
}
|
|
131
132
|
.kd-timeline .kd-timeline-item-tail {
|
|
132
133
|
position: absolute;
|
|
133
|
-
left: calc((9px - 1px) / 2);
|
|
134
|
-
height: calc(100% - 9px * 2 + 4px);
|
|
134
|
+
left: calc((var(--kd-c-timeline-dot-sizing, 9px) - 1px) / 2);
|
|
135
|
+
height: calc(100% - var(--kd-c-timeline-dot-sizing, 9px) * 2 + 4px);
|
|
135
136
|
border-left: var(--kd-c-timeline-sizing-width, 1px) solid var(--kd-c-timeline-line-color, var(--kd-g-color-border-weak, #e5e5e5));
|
|
136
137
|
}
|
|
137
138
|
.kd-timeline .kd-timeline-item.pending .kd-timeline-item-dot {
|
|
@@ -144,8 +145,8 @@
|
|
|
144
145
|
-webkit-box-sizing: border-box;
|
|
145
146
|
box-sizing: border-box;
|
|
146
147
|
position: absolute;
|
|
147
|
-
width: 9px;
|
|
148
|
-
height: 9px;
|
|
148
|
+
width: var(--kd-c-timeline-dot-sizing, 9px);
|
|
149
|
+
height: var(--kd-c-timeline-dot-sizing, 9px);
|
|
149
150
|
border-radius: 50%;
|
|
150
151
|
-webkit-transform: translateY(-50%);
|
|
151
152
|
transform: translateY(-50%);
|
|
@@ -168,7 +169,7 @@
|
|
|
168
169
|
}
|
|
169
170
|
.kd-timeline .kd-timeline-item-dot.custom {
|
|
170
171
|
position: absolute;
|
|
171
|
-
left: calc(9px / 2);
|
|
172
|
+
left: calc(var(--kd-c-timeline-dot-sizing, 9px) / 2);
|
|
172
173
|
width: auto;
|
|
173
174
|
height: auto;
|
|
174
175
|
margin-top: 0;
|
|
@@ -183,7 +184,7 @@
|
|
|
183
184
|
}
|
|
184
185
|
.kd-timeline .kd-timeline-item-content {
|
|
185
186
|
position: relative;
|
|
186
|
-
margin: 0 0 0 calc(2 * (9px - var(--kd-c-timeline-sizing-width, 1px)) + 8px);
|
|
187
|
+
margin: 0 0 0 calc(2 * (var(--kd-c-timeline-dot-sizing, 9px) - var(--kd-c-timeline-sizing-width, 1px)) + 8px);
|
|
187
188
|
word-break: break-word;
|
|
188
189
|
color: var(--kd-c-timeline-content-color-text, var(--kd-g-color-text-primary, #212121));
|
|
189
190
|
}
|
|
@@ -203,7 +204,7 @@
|
|
|
203
204
|
left: 50%;
|
|
204
205
|
}
|
|
205
206
|
.kd-timeline.alternate .kd-timeline-item-dot {
|
|
206
|
-
margin-left: calc(-1 * (9px - 1px) / 2);
|
|
207
|
+
margin-left: calc(-1 * (var(--kd-c-timeline-dot-sizing, 9px) - 1px) / 2);
|
|
207
208
|
}
|
|
208
209
|
.kd-timeline.alternate .kd-timeline-item-dot.custom {
|
|
209
210
|
margin-left: 1px;
|
|
@@ -225,24 +226,24 @@
|
|
|
225
226
|
right: 4.5px;
|
|
226
227
|
}
|
|
227
228
|
.kd-timeline.right .kd-timeline-item-dot {
|
|
228
|
-
margin-right: calc(-1 * (9px - 1px) / 2);
|
|
229
|
+
margin-right: calc(-1 * (var(--kd-c-timeline-dot-sizing, 9px) - 1px) / 2);
|
|
229
230
|
}
|
|
230
231
|
.kd-timeline.right .kd-timeline-item-dot.custom {
|
|
231
|
-
margin-right:
|
|
232
|
+
margin-right: -18px;
|
|
232
233
|
}
|
|
233
234
|
.kd-timeline.right .kd-timeline-item .kd-timeline-item-content {
|
|
234
235
|
left: 0;
|
|
235
236
|
text-align: right;
|
|
236
|
-
margin: 0 calc(2 * (9px - var(--kd-c-timeline-sizing-width, 1px)) + 8px) 0 0;
|
|
237
|
+
margin: 0 calc(2 * (var(--kd-c-timeline-dot-sizing, 9px) - var(--kd-c-timeline-sizing-width, 1px)) + 8px) 0 0;
|
|
237
238
|
width: auto;
|
|
238
239
|
}
|
|
239
240
|
.kd-timeline.label.left .kd-timeline-item-tail,
|
|
240
241
|
.kd-timeline.label.left .kd-timeline-item-dot,
|
|
241
242
|
.kd-timeline.label.left .kd-timeline-item-dot.custom {
|
|
242
|
-
left: calc((2 * 8px) + (9px / 2));
|
|
243
|
+
left: calc((2 * 8px) + (var(--kd-c-timeline-dot-sizing, 9px) / 2));
|
|
243
244
|
}
|
|
244
245
|
.kd-timeline.label.left .kd-timeline-item-dot {
|
|
245
|
-
margin-left: calc(-1 * (9px - 1px) / 2);
|
|
246
|
+
margin-left: calc(-1 * (var(--kd-c-timeline-dot-sizing, 9px) - 1px) / 2);
|
|
246
247
|
}
|
|
247
248
|
.kd-timeline.label.left .kd-timeline-item-dot.custom {
|
|
248
249
|
margin-left: 1px;
|
|
@@ -253,7 +254,7 @@
|
|
|
253
254
|
color: var(--kd-c-timeline-label-color-text, #666666);
|
|
254
255
|
}
|
|
255
256
|
.kd-timeline.label.left .kd-timeline-item .kd-timeline-item-content {
|
|
256
|
-
left: calc(9px + 7.5px);
|
|
257
|
+
left: calc(var(--kd-c-timeline-dot-sizing, 9px) + 7.5px);
|
|
257
258
|
text-align: left;
|
|
258
259
|
margin-right: 16px;
|
|
259
260
|
}
|
|
@@ -261,13 +262,13 @@
|
|
|
261
262
|
.kd-timeline.label.right .kd-timeline-item-dot,
|
|
262
263
|
.kd-timeline.label.right .kd-timeline-item-dot.custom {
|
|
263
264
|
left: auto;
|
|
264
|
-
right: calc((2 * 8px) + (9px / 2));
|
|
265
|
+
right: calc((2 * 8px) + (var(--kd-c-timeline-dot-sizing, 9px) / 2));
|
|
265
266
|
}
|
|
266
267
|
.kd-timeline.label.right .kd-timeline-item-dot {
|
|
267
|
-
margin-right: calc(-1 * (9px - 1px) / 2);
|
|
268
|
+
margin-right: calc(-1 * (var(--kd-c-timeline-dot-sizing, 9px) - 1px) / 2);
|
|
268
269
|
}
|
|
269
270
|
.kd-timeline.label.right .kd-timeline-item-dot.custom {
|
|
270
|
-
right: calc(-1 * (9px - 1px) / 2);
|
|
271
|
+
right: calc(-1 * (var(--kd-c-timeline-dot-sizing, 9px) - 1px) / 2);
|
|
271
272
|
}
|
|
272
273
|
.kd-timeline.label.right .kd-timeline-item .kd-timeline-item-label {
|
|
273
274
|
position: absolute;
|
|
@@ -276,7 +277,7 @@
|
|
|
276
277
|
}
|
|
277
278
|
.kd-timeline.label.right .kd-timeline-item .kd-timeline-item-content {
|
|
278
279
|
left: auto;
|
|
279
|
-
right: calc(9px + 7.5px);
|
|
280
|
+
right: calc(var(--kd-c-timeline-dot-sizing, 9px) + 7.5px);
|
|
280
281
|
text-align: right;
|
|
281
282
|
margin-left: 17px;
|
|
282
283
|
}
|
|
@@ -287,8 +288,8 @@
|
|
|
287
288
|
}
|
|
288
289
|
.kd-timeline.label.alternate .kd-timeline-item:nth-child(2n) .kd-timeline-item-label {
|
|
289
290
|
position: absolute;
|
|
290
|
-
left: calc(50% + (2 * (9px - var(--kd-c-timeline-sizing-width, 1px)) + 8px) - 9px / 2);
|
|
291
|
-
width: calc(50% - (2 * (9px - var(--kd-c-timeline-sizing-width, 1px)) + 8px) + 9px / 2);
|
|
291
|
+
left: calc(50% + (2 * (var(--kd-c-timeline-dot-sizing, 9px) - var(--kd-c-timeline-sizing-width, 1px)) + 8px) - var(--kd-c-timeline-dot-sizing, 9px) / 2);
|
|
292
|
+
width: calc(50% - (2 * (var(--kd-c-timeline-dot-sizing, 9px) - var(--kd-c-timeline-sizing-width, 1px)) + 8px) + var(--kd-c-timeline-dot-sizing, 9px) / 2);
|
|
292
293
|
text-align: left;
|
|
293
294
|
}
|
|
294
295
|
.kd-timeline.pending .kd-timeline-item.last .kd-timeline-item-tail {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
.@{timeline-prefix-cls} {
|
|
10
10
|
.reset-component;
|
|
11
11
|
margin: 0;
|
|
12
|
-
padding: 0;
|
|
12
|
+
padding: 0 4px;
|
|
13
13
|
overflow: hidden;
|
|
14
14
|
list-style: none;
|
|
15
15
|
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
margin-right:calc(-1 * (@timeline-dot-size - 1px) / 2) ;
|
|
149
149
|
|
|
150
150
|
&.custom {
|
|
151
|
-
margin-right:
|
|
151
|
+
margin-right: -18px;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
.@{timeline-item-prefix-cls}-content {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
@import '../../style/themes/token.less';
|
|
2
2
|
|
|
3
3
|
@timeline-prefix: '--@{kd-prefix}-c-timeline';
|
|
4
|
-
@timeline-gap:
|
|
5
|
-
|
|
6
|
-
// @timeline-dot-size: var(~'@{timeline-prefix}-dot-sizing',9px);
|
|
7
|
-
@timeline-dot-size: 9px;
|
|
8
|
-
|
|
4
|
+
@timeline-gap: 8px;
|
|
9
5
|
|
|
6
|
+
@timeline-dot-size: var(~'@{timeline-prefix}-dot-sizing',9px);
|
|
7
|
+
// @timeline-dot-size: 9px;
|
|
10
8
|
|
|
11
9
|
// color
|
|
12
10
|
@timeline-finished-color: var(~'@{timeline-prefix}-finished-color',@color-theme);
|
|
@@ -17,7 +15,6 @@
|
|
|
17
15
|
@timeline-label-color-text: var(~'@{timeline-prefix}-label-color-text',#666666);
|
|
18
16
|
@timeline-content-color-text: var(~'@{timeline-prefix}-content-color-text',@color-text-primary);
|
|
19
17
|
|
|
20
|
-
|
|
21
18
|
// font
|
|
22
19
|
@timeline-content-font-size-small: var(~'@{timeline-prefix}-content-font-size',@font-size-small);
|
|
23
20
|
|
|
@@ -26,7 +23,7 @@
|
|
|
26
23
|
@timeline-width: var(~'@{timeline-prefix}-sizing-width',1px);
|
|
27
24
|
|
|
28
25
|
// spacing
|
|
29
|
-
@timeline-item-padding-bottom: var(~'@{timeline-prefix}-spacing-padding-bottom',
|
|
26
|
+
@timeline-item-padding-bottom: var(~'@{timeline-prefix}-spacing-padding-bottom',24px);
|
|
30
27
|
|
|
31
28
|
|
|
32
29
|
|
package/es/tooltip/tooltip.js
CHANGED
|
@@ -17,7 +17,7 @@ var Tooltip = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
17
17
|
|
|
18
18
|
var prefixCls = getPrefixCls(pkgPrefixCls, 'tooltip', customPrefixcls);
|
|
19
19
|
var tiplocator = /*#__PURE__*/React.cloneElement(React.Children.count(children) === 1 && children.type ? children : /*#__PURE__*/React.createElement("span", null, children), {
|
|
20
|
-
ref: ref
|
|
20
|
+
ref: children.ref || ref
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
var popperProps = _extends(_extends({}, allProps), {
|
package/es/tree/style/index.css
CHANGED
|
@@ -101,6 +101,24 @@
|
|
|
101
101
|
普通组件内部自身层级应设置在0-100间
|
|
102
102
|
*/
|
|
103
103
|
/* ----------- zIndex ——————---- end */
|
|
104
|
+
.node-hover-hover {
|
|
105
|
+
-webkit-transition: background-color var(--kd-c-tree-motion-duration, var(--kd-g-duration, 0.3s)), color var(--kd-c-tree-motion-duration, var(--kd-g-duration, 0.3s));
|
|
106
|
+
transition: background-color var(--kd-c-tree-motion-duration, var(--kd-g-duration, 0.3s)), color var(--kd-c-tree-motion-duration, var(--kd-g-duration, 0.3s));
|
|
107
|
+
}
|
|
108
|
+
.node-hover-hover:hover {
|
|
109
|
+
background-color: var(--kd-c-tree-node-color-backgroung-hover, var(--kd-g-color-hover, #f5f5f5));
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
}
|
|
112
|
+
.node-selected {
|
|
113
|
+
background-color: var(--kd-c-tree-node-color-backgroung-checked, var(--kd-g-color-theme-3, #e3eeff)) !important;
|
|
114
|
+
color: var(--kd-c-tree-node-color-text-checked, var(--kd-g-color-theme, #5582f3));
|
|
115
|
+
}
|
|
116
|
+
.node-selected .kd-tree-node-title {
|
|
117
|
+
color: var(--kd-c-tree-node-color-text-checked, var(--kd-g-color-theme, #5582f3));
|
|
118
|
+
}
|
|
119
|
+
.node-selected .kd-tree-node-icon {
|
|
120
|
+
color: var(--kd-c-tree-node-color-text-checked, var(--kd-g-color-theme, #5582f3));
|
|
121
|
+
}
|
|
104
122
|
.kd-tree {
|
|
105
123
|
position: relative;
|
|
106
124
|
overflow: auto;
|
|
@@ -136,6 +154,15 @@
|
|
|
136
154
|
-ms-flex-align: center;
|
|
137
155
|
align-items: center;
|
|
138
156
|
}
|
|
157
|
+
.kd-tree-node-root .kd-spin-dot-spin {
|
|
158
|
+
border: none;
|
|
159
|
+
width: var(--kd-c-tree-expand-icon-loading-sizing-width, 16px);
|
|
160
|
+
height: var(--kd-c-tree-expand-icon-loading-sizing-height, 16px);
|
|
161
|
+
}
|
|
162
|
+
.kd-tree-node-root .kd-spin-dot-spin .kd-spin-dot-item {
|
|
163
|
+
width: var(--kd-c-tree-expand-icon-loading-sizing-width, 16px);
|
|
164
|
+
height: var(--kd-c-tree-expand-icon-loading-sizing-height, 16px);
|
|
165
|
+
}
|
|
139
166
|
.kd-tree-node-fb-children-pointerEvents * {
|
|
140
167
|
pointer-events: none;
|
|
141
168
|
}
|
|
@@ -176,8 +203,8 @@
|
|
|
176
203
|
}
|
|
177
204
|
.kd-tree-node-icon {
|
|
178
205
|
cursor: pointer;
|
|
179
|
-
height: var(--kd-c-tree-expand-icon-sizing-height,
|
|
180
|
-
width: var(--kd-c-tree-expand-icon-sizing-width,
|
|
206
|
+
height: var(--kd-c-tree-expand-icon-sizing-height, 16px);
|
|
207
|
+
width: var(--kd-c-tree-expand-icon-sizing-width, 16px);
|
|
181
208
|
display: -webkit-box;
|
|
182
209
|
display: -ms-flexbox;
|
|
183
210
|
display: flex;
|
|
@@ -190,9 +217,13 @@
|
|
|
190
217
|
font-size: var(--kd-c-tree-node-icon-font-size, 16px);
|
|
191
218
|
color: var(--kd-c-tree-node-icon-color-text, #666666);
|
|
192
219
|
}
|
|
220
|
+
.kd-tree-node-icon-hover:hover {
|
|
221
|
+
background-color: var(--kd-c-tree-node-color-backgroung-hover, var(--kd-g-color-hover, #f5f5f5));
|
|
222
|
+
cursor: pointer;
|
|
223
|
+
}
|
|
193
224
|
.kd-tree-node-icon-hidden {
|
|
194
|
-
height: var(--kd-c-tree-node-icon-sizing-height,
|
|
195
|
-
width: var(--kd-c-tree-node-icon-sizing-width,
|
|
225
|
+
height: var(--kd-c-tree-node-icon-sizing-height, 16px);
|
|
226
|
+
width: var(--kd-c-tree-node-icon-sizing-width, 16px);
|
|
196
227
|
-ms-flex-negative: 0;
|
|
197
228
|
flex-shrink: 0;
|
|
198
229
|
opacity: 0;
|
|
@@ -233,10 +264,28 @@
|
|
|
233
264
|
-ms-flex-align: center;
|
|
234
265
|
align-items: center;
|
|
235
266
|
height: 100%;
|
|
267
|
+
padding-left: 4px;
|
|
268
|
+
}
|
|
269
|
+
.kd-tree-node-title-wrap-hover {
|
|
270
|
+
-webkit-transition: background-color var(--kd-c-tree-motion-duration, var(--kd-g-duration, 0.3s)), color var(--kd-c-tree-motion-duration, var(--kd-g-duration, 0.3s));
|
|
271
|
+
transition: background-color var(--kd-c-tree-motion-duration, var(--kd-g-duration, 0.3s)), color var(--kd-c-tree-motion-duration, var(--kd-g-duration, 0.3s));
|
|
272
|
+
}
|
|
273
|
+
.kd-tree-node-title-wrap-hover:hover {
|
|
274
|
+
background-color: var(--kd-c-tree-node-color-backgroung-hover, var(--kd-g-color-hover, #f5f5f5));
|
|
275
|
+
cursor: pointer;
|
|
276
|
+
}
|
|
277
|
+
.kd-tree-node-title-wrap-selected {
|
|
278
|
+
background-color: var(--kd-c-tree-node-color-backgroung-checked, var(--kd-g-color-theme-3, #e3eeff)) !important;
|
|
279
|
+
color: var(--kd-c-tree-node-color-text-checked, var(--kd-g-color-theme, #5582f3));
|
|
280
|
+
}
|
|
281
|
+
.kd-tree-node-title-wrap-selected .kd-tree-node-title {
|
|
282
|
+
color: var(--kd-c-tree-node-color-text-checked, var(--kd-g-color-theme, #5582f3));
|
|
283
|
+
}
|
|
284
|
+
.kd-tree-node-title-wrap-selected .kd-tree-node-icon {
|
|
285
|
+
color: var(--kd-c-tree-node-color-text-checked, var(--kd-g-color-theme, #5582f3));
|
|
236
286
|
}
|
|
237
287
|
.kd-tree-node-title {
|
|
238
288
|
white-space: nowrap;
|
|
239
|
-
margin-left: 6px;
|
|
240
289
|
}
|
|
241
290
|
.kd-tree-node-selected {
|
|
242
291
|
background-color: var(--kd-c-tree-node-color-backgroung-checked, var(--kd-g-color-theme-3, #e3eeff)) !important;
|
|
@@ -285,8 +334,8 @@
|
|
|
285
334
|
transform: translateY(-50%);
|
|
286
335
|
}
|
|
287
336
|
.kd-tree-node-leaf-icon {
|
|
288
|
-
height: var(--kd-c-tree-node-icon-sizing-height,
|
|
289
|
-
width: var(--kd-c-tree-node-icon-sizing-width,
|
|
337
|
+
height: var(--kd-c-tree-node-icon-sizing-height, 16px);
|
|
338
|
+
width: var(--kd-c-tree-node-icon-sizing-width, 16px);
|
|
290
339
|
display: -webkit-box;
|
|
291
340
|
display: -ms-flexbox;
|
|
292
341
|
display: flex;
|
package/es/tree/style/index.less
CHANGED
|
@@ -28,6 +28,17 @@
|
|
|
28
28
|
display: flex;
|
|
29
29
|
justify-content: flex-start;
|
|
30
30
|
align-items: center;
|
|
31
|
+
|
|
32
|
+
.@{kd-prefix}-spin-dot-spin {
|
|
33
|
+
border: none;
|
|
34
|
+
width: @tree-expand-icon-loading-width;
|
|
35
|
+
height: @tree-expand-icon-loading-height;
|
|
36
|
+
|
|
37
|
+
.@{kd-prefix}-spin-dot-item {
|
|
38
|
+
width: @tree-expand-icon-loading-width;
|
|
39
|
+
height: @tree-expand-icon-loading-height;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
31
42
|
}
|
|
32
43
|
&-fb-children-pointerEvents * {
|
|
33
44
|
pointer-events: none;
|
|
@@ -35,13 +46,8 @@
|
|
|
35
46
|
&-item {
|
|
36
47
|
display: flex;
|
|
37
48
|
align-items: center;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
transition: background-color @tree-transition-duration, color @tree-transition-duration;
|
|
41
|
-
}
|
|
42
|
-
&-item-hover:hover {
|
|
43
|
-
background-color: @tree-node-hover-bg-color;
|
|
44
|
-
cursor: pointer;
|
|
49
|
+
|
|
50
|
+
.node-hover()
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
&-indent {
|
|
@@ -70,6 +76,11 @@
|
|
|
70
76
|
align-items: center;
|
|
71
77
|
font-size: @tree-node-icon-size;
|
|
72
78
|
color: @tree-node-icon-color-text;
|
|
79
|
+
|
|
80
|
+
&-hover:hover {
|
|
81
|
+
background-color: @tree-node-hover-bg-color;
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
}
|
|
73
84
|
}
|
|
74
85
|
&-icon-hidden {
|
|
75
86
|
height: @tree-node-icon-height;
|
|
@@ -99,22 +110,19 @@
|
|
|
99
110
|
display: flex;
|
|
100
111
|
align-items: center;
|
|
101
112
|
height: 100%;
|
|
113
|
+
padding-left: 4px;
|
|
114
|
+
|
|
115
|
+
.node-hover();
|
|
116
|
+
|
|
117
|
+
&-selected {
|
|
118
|
+
.node-selected()
|
|
119
|
+
}
|
|
102
120
|
}
|
|
103
121
|
&-title {
|
|
104
122
|
white-space: nowrap;
|
|
105
|
-
margin-left: 6px;
|
|
106
123
|
}
|
|
107
124
|
&-selected {
|
|
108
|
-
|
|
109
|
-
color: @tree-node-checked-text-color;
|
|
110
|
-
|
|
111
|
-
.@{tree-node-prefix-cls}-title {
|
|
112
|
-
color: @tree-node-checked-text-color;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.@{tree-node-prefix-cls}-icon {
|
|
116
|
-
color: @tree-node-checked-text-color;
|
|
117
|
-
}
|
|
125
|
+
.node-selected()
|
|
118
126
|
}
|
|
119
127
|
|
|
120
128
|
&-draggabled {
|
package/es/tree/style/mixin.less
CHANGED
|
@@ -1 +1,25 @@
|
|
|
1
|
-
@import './token.less';
|
|
1
|
+
@import './token.less';
|
|
2
|
+
|
|
3
|
+
.node-hover {
|
|
4
|
+
&-hover {
|
|
5
|
+
transition: background-color @tree-transition-duration, color @tree-transition-duration;
|
|
6
|
+
|
|
7
|
+
&:hover {
|
|
8
|
+
background-color: @tree-node-hover-bg-color;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.node-selected {
|
|
15
|
+
background-color: @tree-node-checked-bg-color !important;
|
|
16
|
+
color: @tree-node-checked-text-color;
|
|
17
|
+
|
|
18
|
+
.@{tree-node-prefix-cls}-title {
|
|
19
|
+
color: @tree-node-checked-text-color;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.@{tree-node-prefix-cls}-icon {
|
|
23
|
+
color: @tree-node-checked-text-color;
|
|
24
|
+
}
|
|
25
|
+
}
|
package/es/tree/style/token.less
CHANGED
|
@@ -16,10 +16,12 @@
|
|
|
16
16
|
@tree-node-drag-line-border-color: var(~'@{tree-prefix}-node-drag-line-color-background', #276FF5);
|
|
17
17
|
|
|
18
18
|
// sizing
|
|
19
|
-
@tree-expand-icon-height: var(~'@{tree-prefix}-expand-icon-sizing-height',
|
|
20
|
-
@tree-expand-icon-width: var(~'@{tree-prefix}-expand-icon-sizing-width',
|
|
21
|
-
@tree-
|
|
22
|
-
@tree-
|
|
19
|
+
@tree-expand-icon-height: var(~'@{tree-prefix}-expand-icon-sizing-height', 16px);
|
|
20
|
+
@tree-expand-icon-width: var(~'@{tree-prefix}-expand-icon-sizing-width', 16px);
|
|
21
|
+
@tree-expand-icon-loading-height: var(~'@{tree-prefix}-expand-icon-loading-sizing-height', 16px);
|
|
22
|
+
@tree-expand-icon-loading-width: var(~'@{tree-prefix}-expand-icon-loading-sizing-width', 16px);
|
|
23
|
+
@tree-node-icon-height: var(~'@{tree-prefix}-node-icon-sizing-height', 16px);
|
|
24
|
+
@tree-node-icon-width: var(~'@{tree-prefix}-node-icon-sizing-width', 16px);
|
|
23
25
|
|
|
24
26
|
// font
|
|
25
27
|
@tree-font-size: var(~'@{tree-prefix}-font-size', @font-size-small);
|
package/es/tree/tree.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export interface TreeProps {
|
|
|
24
24
|
virtual?: boolean;
|
|
25
25
|
scrollToKey?: string;
|
|
26
26
|
selectedKeys?: string[];
|
|
27
|
+
loadData?: () => void;
|
|
27
28
|
onCheck?: (checkedKeys: string[], { checked, node, event, halfCheckedKeys }: any) => void;
|
|
28
29
|
onExpand?: (expandedKeys: string[], { expanded, node }: any) => void;
|
|
29
30
|
onSelect?: ({ checked, node, event }: any) => void;
|
|
@@ -36,6 +37,7 @@ export interface TreeProps {
|
|
|
36
37
|
setTreeNodeClassName?: (node: any) => string;
|
|
37
38
|
setTreeNodeStyle?: (node: any) => Map<string, string>;
|
|
38
39
|
estimatedItemSize?: number;
|
|
40
|
+
expandOnClickNode?: boolean;
|
|
39
41
|
}
|
|
40
42
|
export declare type TreeNodeData = {
|
|
41
43
|
checkable?: boolean;
|
package/es/tree/tree.js
CHANGED
|
@@ -2,15 +2,17 @@ import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
3
3
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
4
4
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
5
|
-
import
|
|
5
|
+
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
6
6
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
7
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
7
8
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
8
9
|
import React, { useContext, useCallback, useEffect } from 'react';
|
|
9
10
|
import classNames from 'classnames';
|
|
11
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
10
12
|
import ConfigContext from '../config-provider/ConfigContext';
|
|
11
13
|
import { getCompProps } from '../_utils';
|
|
12
14
|
import TreeNode from './treeNode';
|
|
13
|
-
import { getChecked, getHalfChecked, addKeys, flattenAll, delKey, getFilterData, getSpreadAttrData, getDataCheckededState, getDataCheckededStateStrictly,
|
|
15
|
+
import { getChecked, getHalfChecked, addKeys, flattenAll, delKey, getFilterData, getSpreadAttrData, getDataCheckededState, getDataCheckededStateStrictly, getAllChildKeys, getPos, getSelected, calcDropPosition } from './utils/treeUtils';
|
|
14
16
|
import { useChecked, useExpand, usePlantomHeightEffect, useViewportHeight, useVisibleDataMemo, useScrollToKey, useSelect } from './treeHooks';
|
|
15
17
|
import isBoolean from 'lodash/isBoolean';
|
|
16
18
|
var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -62,7 +64,9 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
62
64
|
innerEstimatedItemSize = TreeProps.estimatedItemSize,
|
|
63
65
|
style = TreeProps.style,
|
|
64
66
|
filterTreeNode = TreeProps.filterTreeNode,
|
|
65
|
-
filterValue = TreeProps.filterValue
|
|
67
|
+
filterValue = TreeProps.filterValue,
|
|
68
|
+
expandOnClickNode = TreeProps.expandOnClickNode,
|
|
69
|
+
loadData = TreeProps.loadData;
|
|
66
70
|
var treePrefixCls = getPrefixCls(prefixCls, 'tree', customPrefixcls); // 树样式前缀
|
|
67
71
|
|
|
68
72
|
var treeNodePrefixCls = getPrefixCls(prefixCls, 'tree-node', customPrefixcls); // 树节点样式前缀
|
|
@@ -71,12 +75,11 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
71
75
|
var treeRootClassName = "".concat(treePrefixCls, "-root");
|
|
72
76
|
var estimatedItemSize = innerEstimatedItemSize; // 节点高度
|
|
73
77
|
|
|
74
|
-
var
|
|
78
|
+
var _React$useMemo = React.useMemo(function () {
|
|
75
79
|
return flattenAll(treeData, []);
|
|
76
|
-
}, [treeData])
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}, [flattenAllData]);
|
|
80
|
+
}, [treeData]),
|
|
81
|
+
flattenAllData = _React$useMemo.flattenAllData,
|
|
82
|
+
maxLevel = _React$useMemo.maxLevel;
|
|
80
83
|
|
|
81
84
|
var _useChecked = useChecked(checkStrictly, checkedKeysProps, defaultCheckedKeys, flattenAllData, maxLevel, checkable),
|
|
82
85
|
_useChecked2 = _slicedToArray(_useChecked, 4),
|
|
@@ -123,7 +126,21 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
123
126
|
dragOverNodeKey = _React$useState10[0],
|
|
124
127
|
setDragOverNodeKey = _React$useState10[1];
|
|
125
128
|
|
|
126
|
-
var
|
|
129
|
+
var _React$useState11 = React.useState(new _Set()),
|
|
130
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
131
|
+
loadedKeys = _React$useState12[0],
|
|
132
|
+
setLoadedKeys = _React$useState12[1];
|
|
133
|
+
|
|
134
|
+
var _React$useState13 = React.useState(new _Set()),
|
|
135
|
+
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
|
136
|
+
loadingKeys = _React$useState14[0],
|
|
137
|
+
setLoadingKeys = _React$useState14[1];
|
|
138
|
+
|
|
139
|
+
var isSearching = React.useMemo(function () {
|
|
140
|
+
return typeof filterTreeNode === 'function' && filterValue;
|
|
141
|
+
}, [filterValue]);
|
|
142
|
+
|
|
143
|
+
var _useExpand = useExpand(flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, scrollKey, isInit, filterTreeNode, isSearching),
|
|
127
144
|
_useExpand2 = _slicedToArray(_useExpand, 2),
|
|
128
145
|
expandedKeys = _useExpand2[0],
|
|
129
146
|
setExpandedKeys = _useExpand2[1];
|
|
@@ -132,8 +149,8 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
132
149
|
return getSpreadAttrData(flattenAllData, expandedKeys);
|
|
133
150
|
}, [flattenAllData, expandedKeys]);
|
|
134
151
|
var filterData = React.useMemo(function () {
|
|
135
|
-
return getFilterData(spreadAttrData, filterTreeNode,
|
|
136
|
-
}, [spreadAttrData,
|
|
152
|
+
return getFilterData(spreadAttrData, filterTreeNode, isSearching);
|
|
153
|
+
}, [spreadAttrData, isSearching]);
|
|
137
154
|
|
|
138
155
|
var _useViewportHeight = useViewportHeight(height, listRef),
|
|
139
156
|
_useViewportHeight2 = _slicedToArray(_useViewportHeight, 1),
|
|
@@ -167,15 +184,54 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
167
184
|
listRef.current.style.transform = "translate3d(0,".concat(tempStartOffset, "px,0)");
|
|
168
185
|
}
|
|
169
186
|
}, [listRef, scrollRef, virtual, estimatedItemSize]);
|
|
170
|
-
var
|
|
171
|
-
var
|
|
187
|
+
var handleNodeLoad = useCallback(function (loadedKeys, loadingKeys, data) {
|
|
188
|
+
var key = data.key;
|
|
189
|
+
|
|
190
|
+
if (!loadData || loadedKeys.has(key) || loadingKeys.has(key)) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
setLoadingKeys(function (prevLoadingKeys) {
|
|
195
|
+
var _context;
|
|
196
|
+
|
|
197
|
+
return new _Set(_concatInstanceProperty(_context = []).call(_context, _toConsumableArray(prevLoadingKeys), [key]));
|
|
198
|
+
});
|
|
199
|
+
loadData(data).then(function () {
|
|
200
|
+
setLoadedKeys(function (prevState) {
|
|
201
|
+
var _context2;
|
|
202
|
+
|
|
203
|
+
return new _Set(_concatInstanceProperty(_context2 = []).call(_context2, _toConsumableArray(prevState), [key]));
|
|
204
|
+
});
|
|
205
|
+
setLoadingKeys(function (prevState) {
|
|
206
|
+
var prevLoadingKeys = cloneDeep(prevState);
|
|
207
|
+
prevLoadingKeys.delete(key);
|
|
208
|
+
return prevLoadingKeys;
|
|
209
|
+
});
|
|
210
|
+
}).catch(function (e) {
|
|
211
|
+
setLoadingKeys(function (prevState) {
|
|
212
|
+
var prevLoadingKeys = cloneDeep(prevState);
|
|
213
|
+
prevLoadingKeys.delete(key);
|
|
214
|
+
return prevLoadingKeys;
|
|
215
|
+
});
|
|
216
|
+
setExpandedKeys(function (preExpandedKeys) {
|
|
217
|
+
return delKey(_toConsumableArray(preExpandedKeys), [key]);
|
|
218
|
+
});
|
|
219
|
+
throw e;
|
|
220
|
+
});
|
|
221
|
+
}, [loadData, setExpandedKeys]);
|
|
222
|
+
var handleExpand = React.useCallback(function (key, expanded, node) {
|
|
223
|
+
var newExpandedKeys = expanded ? addKeys(expandedKeys, [key]) : delKey(expandedKeys, [key]);
|
|
172
224
|
onExpand && onExpand(newExpandedKeys, {
|
|
173
225
|
node: node,
|
|
174
|
-
expanded:
|
|
226
|
+
expanded: expanded
|
|
175
227
|
});
|
|
176
228
|
setScrollKey('');
|
|
177
229
|
setIsInit(false);
|
|
178
|
-
|
|
230
|
+
|
|
231
|
+
if (expanded && loadData) {
|
|
232
|
+
handleNodeLoad(loadedKeys, loadingKeys, node);
|
|
233
|
+
}
|
|
234
|
+
}, [expandedKeys, onExpand, loadData, handleNodeLoad, loadedKeys, loadingKeys]);
|
|
179
235
|
var handleCheck = React.useCallback(function (key, value, node, event, pos) {
|
|
180
236
|
var newCheckedKeys = value ? addKeys(checkedKeys, [key]) : delKey(checkedKeys, [key]);
|
|
181
237
|
var checkState = checkStrictly ? getDataCheckededStateStrictly(newCheckedKeys) : getDataCheckededState(spreadAttrData, newCheckedKeys, halfCheckedKeys, maxLevel, false, pos, value);
|
|
@@ -264,11 +320,11 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
264
320
|
});
|
|
265
321
|
}, [onDragEnd]);
|
|
266
322
|
var handleDrop = React.useCallback(function (event, node, dragNode, dragNodesKeys) {
|
|
267
|
-
var
|
|
323
|
+
var _context3;
|
|
268
324
|
|
|
269
325
|
var pos = getPos(flattenAllData, dragNodesKeys);
|
|
270
326
|
|
|
271
|
-
var keys = _concatInstanceProperty(
|
|
327
|
+
var keys = _concatInstanceProperty(_context3 = getAllChildKeys(flattenAllData, pos)).call(_context3, dragNodesKeys);
|
|
272
328
|
|
|
273
329
|
onDrop && onDrop({
|
|
274
330
|
event: event,
|
|
@@ -334,7 +390,6 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
334
390
|
className: treeRootClassName,
|
|
335
391
|
ref: listRef
|
|
336
392
|
}, visibleData && _mapInstanceProperty(visibleData).call(visibleData, function (item) {
|
|
337
|
-
// const props: any = {}
|
|
338
393
|
var checked = getChecked(checkedKeys, item.key);
|
|
339
394
|
var indeterminate = getHalfChecked(halfCheckedKeys, item.key);
|
|
340
395
|
item.nodeKey = item.key;
|
|
@@ -349,8 +404,7 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
349
404
|
item.onSelect = handleSelect;
|
|
350
405
|
item.checked = checked;
|
|
351
406
|
item.selected = getSelected(selectedKeys, item.key);
|
|
352
|
-
item.indeterminate = indeterminate;
|
|
353
|
-
|
|
407
|
+
item.indeterminate = indeterminate;
|
|
354
408
|
item.disabled = getDisabled(disabled, item.disabled);
|
|
355
409
|
item.showIcon = showIcon || false;
|
|
356
410
|
item.checkable = getCheckable(checkable, item.checkable); // 哪个优先
|
|
@@ -365,6 +419,9 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
365
419
|
item.getDragNode = getDragNode;
|
|
366
420
|
item.setDragNode = setDragNode;
|
|
367
421
|
item.dragOver = dragOverNodeKey === item.key && dropPosition === 0;
|
|
422
|
+
item.expandOnClickNode = expandOnClickNode;
|
|
423
|
+
item.loading = loadingKeys.has(item.key) && !loadedKeys.has(item.key);
|
|
424
|
+
item.loadData = loadData;
|
|
368
425
|
return /*#__PURE__*/React.createElement(TreeNode, _extends({}, item, {
|
|
369
426
|
key: item.key,
|
|
370
427
|
ref: treeNodeRef
|
package/es/tree/treeHooks.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export declare const useViewportHeight: (height: number, listRef: React.RefObjec
|
|
|
4
4
|
export declare const useVisibleDataMemo: (virtual: boolean, filterData: TreeNodeData[], viewportHeight: number, estimatedItemSize: number, start: number) => TreeNodeData[][];
|
|
5
5
|
export declare const usePlantomHeightEffect: (plantomRef: React.RefObject<HTMLElement>, filterData: TreeNodeData[], estimatedItemSize: number) => void;
|
|
6
6
|
export declare const useChecked: (checkStrictly: boolean, checkedKeysProps: string[], defaultCheckedKeys: string[], flattenAllData: any[], maxLevel: number, checkable: boolean) => readonly [string[], string[], React.Dispatch<React.SetStateAction<string[]>>, React.Dispatch<React.SetStateAction<string[]>>];
|
|
7
|
-
export declare const useExpand: (flattenAllData: any[], expandedKeysProps: string[], defaultExpandedKeys: string[], defaultExpandAll: boolean, defaultExpandRoot: boolean, defaultExpandParent: boolean, scrollKey: string, isInit: boolean, filterTreeNode: FunctionConstructor,
|
|
7
|
+
export declare const useExpand: (flattenAllData: any[], expandedKeysProps: string[], defaultExpandedKeys: string[], defaultExpandAll: boolean, defaultExpandRoot: boolean, defaultExpandParent: boolean, scrollKey: string, isInit: boolean, filterTreeNode: FunctionConstructor, isSearching: boolean) => readonly [string[], React.Dispatch<React.SetStateAction<string[]>>];
|
|
8
8
|
export declare const useScrollToKey: (scrollKey: string, index: number, estimatedItemSize: number, scrollRef: any, viewportHeight: number, treeNodePrefixCls: string) => void;
|
|
9
9
|
export declare const useSelect: (selectedKeysProps: string[], defaultSelectedKeys: string[]) => readonly [string[], React.Dispatch<React.SetStateAction<string[]>>];
|
package/es/tree/treeHooks.js
CHANGED
|
@@ -64,7 +64,7 @@ export var useChecked = function useChecked(checkStrictly, checkedKeysProps, def
|
|
|
64
64
|
}, [nextHalfCheckedKeys]);
|
|
65
65
|
return [checkedKeys, halfCheckedKeys, setCheckedKeys, setHalfCheckedKeys];
|
|
66
66
|
};
|
|
67
|
-
export var useExpand = function useExpand(flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, scrollKey, isInit, filterTreeNode,
|
|
67
|
+
export var useExpand = function useExpand(flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, scrollKey, isInit, filterTreeNode, isSearching) {
|
|
68
68
|
var expandScrollkeys = [];
|
|
69
69
|
|
|
70
70
|
if (scrollKey) {
|
|
@@ -73,8 +73,8 @@ export var useExpand = function useExpand(flattenAllData, expandedKeysProps, def
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
var initialExpandedKeys = React.useMemo(function () {
|
|
76
|
-
return getInitExpandedKeys(flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, expandScrollkeys, filterTreeNode,
|
|
77
|
-
}, [flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, scrollKey, filterTreeNode,
|
|
76
|
+
return getInitExpandedKeys(flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, expandScrollkeys, filterTreeNode, isSearching);
|
|
77
|
+
}, [flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, scrollKey, filterTreeNode, isSearching]);
|
|
78
78
|
var newExpandedKeys = React.useMemo(function () {
|
|
79
79
|
return getExpandedKeys(expandedKeysProps, expandScrollkeys);
|
|
80
80
|
}, [expandedKeysProps]);
|
|
@@ -112,7 +112,6 @@ export var useScrollToKey = function useScrollToKey(scrollKey, index, estimatedI
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
if (treeRoot && treeNode) {
|
|
115
|
-
// const treeRootScrollTop = treeRoot.scrollTop
|
|
116
115
|
var treeRootRect = treeRoot.getBoundingClientRect();
|
|
117
116
|
var treeNodeRect = treeNode.getBoundingClientRect();
|
|
118
117
|
|