@kdcloudjs/kdesign 1.7.21 → 1.7.22

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/kdesign-complete.less +6 -3
  3. package/dist/kdesign.css +9 -4
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +110 -44
  6. package/dist/kdesign.js.map +1 -1
  7. package/dist/kdesign.min.css +3 -3
  8. package/dist/kdesign.min.js +6 -6
  9. package/dist/kdesign.min.js.map +1 -1
  10. package/es/_utils/reactNode.d.ts +1 -0
  11. package/es/_utils/reactNode.js +3 -0
  12. package/es/checkbox/group.js +1 -1
  13. package/es/collapse/style/index.css +3 -0
  14. package/es/collapse/style/index.less +3 -0
  15. package/es/dropdown/dropdown.js +4 -3
  16. package/es/input/input.js +21 -3
  17. package/es/input-number/inputNumber.js +6 -0
  18. package/es/menu/menu.js +27 -18
  19. package/es/menu/style/index.css +3 -0
  20. package/es/menu/style/mixin.less +1 -0
  21. package/es/select/select.js +17 -3
  22. package/es/timeline/TimelineItem.js +2 -1
  23. package/es/timeline/style/index.css +2 -3
  24. package/es/timeline/style/index.less +2 -3
  25. package/es/tooltip/tooltip.js +3 -2
  26. package/es/tree/tree.js +8 -1
  27. package/es/virtual-list/Filler.d.ts +1 -0
  28. package/es/virtual-list/Filler.js +4 -3
  29. package/es/virtual-list/virtual-list.d.ts +1 -0
  30. package/es/virtual-list/virtual-list.js +5 -3
  31. package/lib/_utils/reactNode.d.ts +1 -0
  32. package/lib/_utils/reactNode.js +4 -0
  33. package/lib/checkbox/group.js +1 -1
  34. package/lib/collapse/style/index.css +3 -0
  35. package/lib/collapse/style/index.less +3 -0
  36. package/lib/dropdown/dropdown.js +4 -3
  37. package/lib/input/input.js +20 -2
  38. package/lib/input-number/inputNumber.js +6 -0
  39. package/lib/menu/menu.js +26 -17
  40. package/lib/menu/style/index.css +3 -0
  41. package/lib/menu/style/mixin.less +1 -0
  42. package/lib/select/select.js +16 -2
  43. package/lib/timeline/TimelineItem.js +2 -1
  44. package/lib/timeline/style/index.css +2 -3
  45. package/lib/timeline/style/index.less +2 -3
  46. package/lib/tooltip/tooltip.js +3 -2
  47. package/lib/tree/tree.js +8 -1
  48. package/lib/virtual-list/Filler.d.ts +1 -0
  49. package/lib/virtual-list/Filler.js +4 -3
  50. package/lib/virtual-list/virtual-list.d.ts +1 -0
  51. package/lib/virtual-list/virtual-list.js +5 -3
  52. package/package.json +1 -1
@@ -3,5 +3,6 @@ export declare const isValidElement: typeof React.isValidElement;
3
3
  declare type AnyObject = Record<any, any>;
4
4
  declare type RenderProps = undefined | AnyObject | ((originProps: AnyObject) => AnyObject | undefined);
5
5
  export declare function replaceElement(element: React.ReactNode, replacement: React.ReactNode, props: RenderProps): React.ReactNode;
6
+ export declare function isFragment(child: any): boolean;
6
7
  export declare function cloneElement(element: React.ReactNode, props?: RenderProps): React.ReactElement;
7
8
  export {};
@@ -5,6 +5,9 @@ export function replaceElement(element, replacement, props) {
5
5
  if (!isValidElement(element)) return replacement;
6
6
  return /*#__PURE__*/React.cloneElement(element, typeof props === 'function' ? props(element.props || {}) : props);
7
7
  }
8
+ export function isFragment(child) {
9
+ return child && isValidElement(child) && child.type === React.Fragment;
10
+ }
8
11
  export function cloneElement(element, props) {
9
12
  return replaceElement(element, element, props);
10
13
  }
@@ -29,7 +29,7 @@ var CheckboxGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
29
29
  getPrefixCls = _useContext.getPrefixCls,
30
30
  prefixCls = _useContext.prefixCls,
31
31
  userDefaultProps = _useContext.compDefaultProps;
32
- var CheckboxProps = getCompProps('Checkbox', userDefaultProps, props); // 按钮属性需要合并一遍用户定义的默认属性
32
+ var CheckboxProps = getCompProps('CheckboxGroup', userDefaultProps, props); // 多选组属性需要合并一遍用户定义的默认属性
33
33
  var checkboxType = CheckboxProps.checkboxType,
34
34
  className = CheckboxProps.className,
35
35
  style = CheckboxProps.style,
@@ -116,6 +116,9 @@
116
116
  .kd-collapse-panel:last-child {
117
117
  border-top: none;
118
118
  }
119
+ .kd-collapse-panel:first-child {
120
+ border-top: var(--kd-c-collapse-border-width, 1px) solid var(--kd-c-collapse-color-border-strong-2, var(--kd-g-color-border-strong-2, #d9d9d9));
121
+ }
119
122
  .kd-collapse-panel {
120
123
  display: -webkit-inline-box;
121
124
  display: -ms-inline-flexbox;
@@ -9,6 +9,9 @@
9
9
  &-panel:last-child {
10
10
  border-top: none;
11
11
  }
12
+ &-panel:first-child {
13
+ border-top: @collapse-border-width solid @collapse-border-color;
14
+ }
12
15
  &-panel {
13
16
  display: inline-flex;
14
17
  flex-direction: column;
@@ -7,6 +7,7 @@ import ConfigContext from '../config-provider/ConfigContext';
7
7
  import { getCompProps } from '../_utils';
8
8
  import { Menu, Item } from './menu';
9
9
  import usePopper from '../_utils/usePopper';
10
+ import { isFragment } from '../_utils/reactNode';
10
11
  var findItem = function findItem(element) {
11
12
  var isItem = /dropdown-menu-item/.test(element.className);
12
13
  if (isItem) {
@@ -59,9 +60,9 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
59
60
  children.props.onBlur && children.props.onBlur(e);
60
61
  handleVisibleChange(false);
61
62
  }
62
- }) : children) : /*#__PURE__*/React.cloneElement(React.Children.only(children), {
63
- ref: children.ref || ref,
64
- className: classNames("".concat(prefixCls, "-trigger"), children.props.className, {
63
+ }) : children) : /*#__PURE__*/React.cloneElement( /*#__PURE__*/React.isValidElement(children) && !isFragment(children) ? children : /*#__PURE__*/React.createElement("span", null, children), {
64
+ ref: /*#__PURE__*/React.isValidElement(children) && !isFragment(children) && children.ref ? children.ref : ref,
65
+ className: classNames("".concat(prefixCls, "-trigger"), /*#__PURE__*/React.isValidElement(children) && !isFragment(children) && children.props && children.props.className, {
65
66
  disabled: disabled
66
67
  })
67
68
  });
package/es/input/input.js CHANGED
@@ -11,7 +11,7 @@ var __rest = this && this.__rest || function (s, e) {
11
11
  }
12
12
  return t;
13
13
  };
14
- import React, { useContext, useState, useRef, useEffect } from 'react';
14
+ import React, { useContext, useState, useRef, useEffect, useImperativeHandle } from 'react';
15
15
  import classNames from 'classnames';
16
16
  import ConfigContext from '../config-provider/ConfigContext';
17
17
  import { getCompProps } from '../_utils';
@@ -68,8 +68,7 @@ var InternalInput = function InternalInput(props, ref) {
68
68
  _useState4 = _slicedToArray(_useState3, 2),
69
69
  showNumberMark = _useState4[0],
70
70
  setShowNumberMark = _useState4[1];
71
- var thisInputRef = useRef();
72
- var inputRef = ref || thisInputRef;
71
+ var inputRef = useRef();
73
72
  var inputPrefixCls = getPrefixCls(prefixCls, 'input', customPrefixcls); // 按钮样式前缀
74
73
  var addonBefore = others.addonBefore,
75
74
  addonAfter = others.addonAfter;
@@ -148,6 +147,25 @@ var InternalInput = function InternalInput(props, ref) {
148
147
  setShowNumberMark(false);
149
148
  }
150
149
  }, [focused]);
150
+ useImperativeHandle(ref, function () {
151
+ return {
152
+ input: inputRef.current,
153
+ focus: function focus() {
154
+ var _a;
155
+ setFocused(true);
156
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
157
+ },
158
+ blur: function blur() {
159
+ var _a;
160
+ setFocused(false);
161
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
162
+ },
163
+ select: function select() {
164
+ var _a;
165
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.select();
166
+ }
167
+ };
168
+ });
151
169
  return /*#__PURE__*/React.createElement(ClearableInput, _extends({}, inputProps, {
152
170
  handleReset: handleReset,
153
171
  value: value,
@@ -72,6 +72,9 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
72
72
  return true;
73
73
  };
74
74
  useEffect(function () {
75
+ if (typeof value === 'undefined') {
76
+ return;
77
+ }
75
78
  setInputValue(serialization(value + ''));
76
79
  }, [value]);
77
80
  var handleEventAttachValue = function handleEventAttachValue(event, value) {
@@ -240,6 +243,9 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
240
243
  inputStatus.current.inputFocused = false;
241
244
  };
242
245
  useEffect(function () {
246
+ if (typeof value === 'undefined') {
247
+ return;
248
+ }
243
249
  var _inputStatus$current = inputStatus.current,
244
250
  isHandleChange = _inputStatus$current.isHandleChange,
245
251
  inputFocused = _inputStatus$current.inputFocused;
package/es/menu/menu.js CHANGED
@@ -14,7 +14,7 @@ var __rest = this && this.__rest || function (s, e) {
14
14
  }
15
15
  return t;
16
16
  };
17
- import React, { useEffect } from 'react';
17
+ import React, { useContext, useEffect, useState } from 'react';
18
18
  import { toArray } from '../_utils/react-children';
19
19
  import { ConfigContext } from '../config-provider';
20
20
  import { getCompProps } from '../_utils';
@@ -29,10 +29,10 @@ var openSubMenuSet = new _Set();
29
29
  var Menu = function Menu(props) {
30
30
  var _context2, _classNames;
31
31
  var _a;
32
- var _React$useContext = React.useContext(ConfigContext),
33
- getPrefixCls = _React$useContext.getPrefixCls,
34
- pkgPrefixCls = _React$useContext.prefixCls,
35
- userDefaultProps = _React$useContext.compDefaultProps;
32
+ var _useContext = useContext(ConfigContext),
33
+ getPrefixCls = _useContext.getPrefixCls,
34
+ pkgPrefixCls = _useContext.prefixCls,
35
+ userDefaultProps = _useContext.compDefaultProps;
36
36
  var userSelectedKey = props.selectedKey,
37
37
  userOpenKeys = props.openKeys;
38
38
  var _b = getCompProps('Menu', userDefaultProps, props),
@@ -48,22 +48,23 @@ var Menu = function Menu(props) {
48
48
  theme = _b.theme,
49
49
  collapsed = _b.collapsed,
50
50
  accordion = _b.accordion,
51
- restProps = __rest(_b, ["prefixCls", "mode", "inlineIndent", "forceSubMenuRender", "additionalTools", "onClick", "onOpenChange", "children", "className", "theme", "collapsed", "accordion"]);
51
+ defaultOpenKeys = _b.defaultOpenKeys,
52
+ restProps = __rest(_b, ["prefixCls", "mode", "inlineIndent", "forceSubMenuRender", "additionalTools", "onClick", "onOpenChange", "children", "className", "theme", "collapsed", "accordion", "defaultOpenKeys"]);
52
53
  var prefixCls = getPrefixCls(pkgPrefixCls, 'menu', customPrefixcls);
53
54
  devWarning(['inline', 'vertical', undefined].indexOf(mode) === -1, 'menu', "cannot found menu mode '".concat(mode, "'"));
54
55
  devWarning(mode !== 'inline' && accordion !== undefined, 'menu', "'accordion' is valid only in mode='inline'");
55
- var _React$useState = React.useState(''),
56
- _React$useState2 = _slicedToArray(_React$useState, 2),
57
- selectedKey = _React$useState2[0],
58
- setSelectedKey = _React$useState2[1];
59
- var _React$useState3 = React.useState([]),
60
- _React$useState4 = _slicedToArray(_React$useState3, 2),
61
- selectedKeyPath = _React$useState4[0],
62
- setSelectedKeyPath = _React$useState4[1];
63
- var _React$useState5 = React.useState([]),
64
- _React$useState6 = _slicedToArray(_React$useState5, 2),
65
- openKeys = _React$useState6[0],
66
- setOpenKeys = _React$useState6[1];
56
+ var _useState = useState(''),
57
+ _useState2 = _slicedToArray(_useState, 2),
58
+ selectedKey = _useState2[0],
59
+ setSelectedKey = _useState2[1];
60
+ var _useState3 = useState([]),
61
+ _useState4 = _slicedToArray(_useState3, 2),
62
+ selectedKeyPath = _useState4[0],
63
+ setSelectedKeyPath = _useState4[1];
64
+ var _useState5 = useState([]),
65
+ _useState6 = _slicedToArray(_useState5, 2),
66
+ openKeys = _useState6[0],
67
+ setOpenKeys = _useState6[1];
67
68
  if (mode === 'inline') {
68
69
  restProps.triggerSubMenuAction = 'click';
69
70
  }
@@ -78,6 +79,14 @@ var Menu = function Menu(props) {
78
79
  setSelectedKey(userSelectedKey);
79
80
  }
80
81
  }, [userSelectedKey]);
82
+ useEffect(function () {
83
+ if (Array.isArray(defaultOpenKeys)) {
84
+ setOpenKeys(defaultOpenKeys);
85
+ defaultOpenKeys.forEach(function (d) {
86
+ openSubMenuSet.add(d);
87
+ });
88
+ }
89
+ }, []);
81
90
  useEffect(function () {
82
91
  if (userOpenKeys !== undefined && Array.isArray(userOpenKeys)) {
83
92
  setOpenKeys(userOpenKeys);
@@ -107,6 +107,7 @@
107
107
  /* 单行显示省略号 */
108
108
  /** 浮层箭头样式 **/
109
109
  .menu-hidden {
110
+ display: none;
110
111
  opacity: 0;
111
112
  visibility: hidden;
112
113
  -webkit-animation: kdZoomTopLeftOut calc(var(--kd-c-menu-motion-duration, var(--kd-g-duration, 0.3s)) - 0.1s) cubic-bezier(0, 0.4, 0.4, 1) forwards;
@@ -534,6 +535,7 @@
534
535
  color: var(--kd-c-menu-sub-color-text-hover, var(--kd-g-color-white, #fff));
535
536
  }
536
537
  .kd-menu-popper.hidden {
538
+ display: none;
537
539
  opacity: 0;
538
540
  visibility: hidden;
539
541
  -webkit-animation: kdZoomTopLeftOut calc(var(--kd-c-menu-motion-duration, var(--kd-g-duration, 0.3s)) - 0.1s) cubic-bezier(0, 0.4, 0.4, 1) forwards;
@@ -575,6 +577,7 @@
575
577
  transition-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
576
578
  }
577
579
  .kd-menu-popper .kd-menu-submenu-sub-hide {
580
+ display: none;
578
581
  opacity: 0;
579
582
  visibility: hidden;
580
583
  -webkit-animation: kdZoomTopLeftOut calc(var(--kd-c-menu-motion-duration, var(--kd-g-duration, 0.3s)) - 0.1s) cubic-bezier(0, 0.4, 0.4, 1) forwards;
@@ -79,6 +79,7 @@
79
79
  }
80
80
 
81
81
  .menu-hidden {
82
+ display: none;
82
83
  opacity: 0;
83
84
  visibility: hidden;
84
85
  animation: kdZoomTopLeftOut calc(@menu-motion-duration - 0.1s) cubic-bezier(0, .4, .4, 1) forwards;
@@ -8,7 +8,7 @@ import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instanc
8
8
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
9
9
  import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
10
10
  import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
11
- import React, { useContext, useRef, useEffect, useState, useCallback, useLayoutEffect, useMemo } from 'react';
11
+ import React, { useContext, useRef, useEffect, useState, useCallback, useLayoutEffect, useMemo, useImperativeHandle } from 'react';
12
12
  import { useMergedState } from '../_utils/hooks';
13
13
  import isBoolean from 'lodash/isBoolean';
14
14
  import classNames from 'classnames';
@@ -73,8 +73,7 @@ var InternalSelect = function InternalSelect(props, ref) {
73
73
  initValue = _useMergedState2[0],
74
74
  setInitValue = _useMergedState2[1];
75
75
  var realChildren = Array.isArray(options) ? options : toArray(children); // options配置项和默认children
76
- var innerRef = useRef();
77
- var selectRef = ref || innerRef;
76
+ var selectRef = useRef();
78
77
  var searchRef = useRef(null); // 搜索框ref
79
78
  var selectionRef = useRef(null);
80
79
  var dropDownRef = useRef(null);
@@ -742,6 +741,21 @@ var InternalSelect = function InternalSelect(props, ref) {
742
741
  (_a = clearRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseup', fn);
743
742
  };
744
743
  }, [singleVal, mulOptions]);
744
+ useImperativeHandle(ref, function () {
745
+ return {
746
+ select: selectRef.current,
747
+ focus: function focus() {
748
+ var _a;
749
+ setFocusd(true);
750
+ (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
751
+ },
752
+ blur: function blur() {
753
+ var _a;
754
+ setFocusd(false);
755
+ (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.blur();
756
+ }
757
+ };
758
+ });
745
759
  var _useState13 = useState(isShowSearch ? getActiveIndex(0) : -1),
746
760
  _useState14 = _slicedToArray(_useState13, 2),
747
761
  activeIndex = _useState14[0],
@@ -43,6 +43,7 @@ var TimelineItem = function TimelineItem(props) {
43
43
  var labelStyle = mode !== 'alternate' ? _defineProperty({
44
44
  width: "".concat(labelWidth, "px")
45
45
  }, _concatInstanceProperty(_context = "margin".concat(mode === null || mode === void 0 ? void 0 : mode.substring(0, 1).toUpperCase())).call(_context, mode === null || mode === void 0 ? void 0 : mode.substring(1)), "-".concat(labelWidth, "px")) : {};
46
+ var marginDistance = pending ? Math.round(lineHeight / 2 + 12 / 2 + 2) : Math.round(lineHeight / 2 + 9 / 2 + 2);
46
47
  return /*#__PURE__*/React.createElement("li", _extends({}, restProps, {
47
48
  className: itemClassName
48
49
  }), label && /*#__PURE__*/React.createElement("div", {
@@ -53,7 +54,7 @@ var TimelineItem = function TimelineItem(props) {
53
54
  }, label), /*#__PURE__*/React.createElement("div", {
54
55
  className: "".concat(prefixCls, "-tail"),
55
56
  style: {
56
- marginTop: lineHeight - 2
57
+ marginTop: marginDistance
57
58
  }
58
59
  }), /*#__PURE__*/React.createElement("div", {
59
60
  className: dotClassName,
@@ -297,16 +297,15 @@
297
297
  .kd-timeline.pending .kd-timeline-item.last .kd-timeline-item-tail {
298
298
  display: block;
299
299
  height: calc(100% - 14px);
300
- border-left: 2px dotted var(--kd-c-timeline-line-color, var(--kd-g-color-border-weak, #e5e5e5));
300
+ border-left: 1px dotted var(--kd-c-timeline-line-color, var(--kd-g-color-border-weak, #e5e5e5));
301
301
  }
302
302
  .kd-timeline.reverse .kd-timeline-item.last .kd-timeline-item-tail {
303
303
  display: none;
304
304
  }
305
305
  .kd-timeline.reverse .kd-timeline-item.pending .kd-timeline-item-tail {
306
- top: 15px;
307
306
  display: block;
308
307
  height: calc(100% - 15px);
309
- border-left: 2px dotted var(--kd-c-timeline-line-color, var(--kd-g-color-border-weak, #e5e5e5));
308
+ border-left: 1px dotted var(--kd-c-timeline-line-color, var(--kd-g-color-border-weak, #e5e5e5));
310
309
  }
311
310
  .kd-timeline.reverse .kd-timeline-item.pending .kd-timeline-item-content {
312
311
  min-height: 48px;
@@ -241,7 +241,7 @@
241
241
  &.pending .@{timeline-item-prefix-cls}.last .@{timeline-item-prefix-cls}-tail {
242
242
  display: block;
243
243
  height: calc(100% - 14px);
244
- border-left: 2px dotted @timeline-line-color;
244
+ border-left: 1px dotted @timeline-line-color;
245
245
  }
246
246
 
247
247
  &.reverse .@{timeline-item-prefix-cls}.last .@{timeline-item-prefix-cls}-tail {
@@ -250,10 +250,9 @@
250
250
 
251
251
  &.reverse .@{timeline-item-prefix-cls}.pending {
252
252
  .@{timeline-item-prefix-cls}-tail {
253
- top: 15px;
254
253
  display: block;
255
254
  height: calc(100% - 15px);
256
- border-left: 2px dotted @timeline-line-color;
255
+ border-left: 1px dotted @timeline-line-color;
257
256
  }
258
257
  .@{timeline-item-prefix-cls}-content {
259
258
  min-height: 48px;
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
2
  import React, { useRef } from 'react';
3
3
  import { getCompProps } from '../_utils';
4
+ import { isFragment } from '../_utils/reactNode';
4
5
  import { ConfigContext } from '../config-provider';
5
6
  import usePopper from '../_utils/usePopper';
6
7
  var Tooltip = /*#__PURE__*/React.forwardRef(function (props, ref) {
@@ -16,8 +17,8 @@ var Tooltip = /*#__PURE__*/React.forwardRef(function (props, ref) {
16
17
  customPrefixcls = allProps.prefixCls;
17
18
  // className前缀
18
19
  var prefixCls = getPrefixCls(pkgPrefixCls, 'tooltip', customPrefixcls);
19
- var tiplocator = /*#__PURE__*/React.cloneElement(React.Children.count(children) === 1 && children.type ? children : /*#__PURE__*/React.createElement("span", null, children), {
20
- ref: children.ref || ref
20
+ var tiplocator = /*#__PURE__*/React.cloneElement( /*#__PURE__*/React.isValidElement(children) && !isFragment(children) ? children : /*#__PURE__*/React.createElement("span", null, children), {
21
+ ref: /*#__PURE__*/React.isValidElement(children) && !isFragment(children) && children.ref ? children.ref : ref
21
22
  });
22
23
  var onVisibleChange = function onVisibleChange(v) {
23
24
  if (status.current === v && allProps.visible === undefined) return;
package/es/tree/tree.js CHANGED
@@ -426,7 +426,14 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
426
426
  return item === null || item === void 0 ? void 0 : item.key;
427
427
  },
428
428
  height: height,
429
- itemHeight: estimatedItemSize
429
+ itemHeight: estimatedItemSize,
430
+ outerStyle: {
431
+ overflow: 'unset'
432
+ },
433
+ innerStyle: {
434
+ minWidth: '100%',
435
+ width: 'max-contnet'
436
+ }
430
437
  }, renderTreeNode) : _mapInstanceProperty(filterData).call(filterData, renderTreeNode)));
431
438
  });
432
439
  var Tree = InternalTree;
@@ -3,6 +3,7 @@ interface FillerProps {
3
3
  height: number;
4
4
  offset?: number;
5
5
  outerStyle?: React.CSSProperties;
6
+ innerStyle?: React.CSSProperties;
6
7
  children: React.ReactNode;
7
8
  }
8
9
  declare const Filler: React.FC<FillerProps>;
@@ -4,7 +4,8 @@ var Filler = function Filler(_ref) {
4
4
  var height = _ref.height,
5
5
  offset = _ref.offset,
6
6
  children = _ref.children,
7
- propsOuterStyle = _ref.outerStyle;
7
+ propsOuterStyle = _ref.outerStyle,
8
+ propsInnerStyle = _ref.innerStyle;
8
9
  var outerStyle = {};
9
10
  var innerStyle = {
10
11
  display: 'flex',
@@ -17,13 +18,13 @@ var Filler = function Filler(_ref) {
17
18
  overflow: 'hidden',
18
19
  zIndex: 0
19
20
  }, propsOuterStyle);
20
- innerStyle = _extends(_extends({}, innerStyle), {
21
+ innerStyle = _extends(_extends(_extends({}, innerStyle), {
21
22
  transform: "translateY(".concat(offset, "px)"),
22
23
  position: 'absolute',
23
24
  left: 0,
24
25
  right: 0,
25
26
  top: 0
26
- });
27
+ }), propsInnerStyle);
27
28
  }
28
29
  return /*#__PURE__*/React.createElement("div", {
29
30
  style: outerStyle
@@ -17,6 +17,7 @@ export interface VirtualListProps<T> extends Omit<React.HTMLAttributes<any>, 'ch
17
17
  scrollOptions?: ScrollIntoViewOptions;
18
18
  needFiller?: boolean;
19
19
  outerStyle?: CSSProperties;
20
+ innerStyle?: CSSProperties;
20
21
  onScroll?: React.UIEventHandler<HTMLElement>;
21
22
  }
22
23
  export declare type AvailableVirtualListProps = Pick<VirtualListProps<any>, 'height' | 'itemHeight' | 'threshold' | 'isStaticItemHeight' | 'scrollOptions'>;
@@ -74,7 +74,7 @@ var VirtualList = /*#__PURE__*/React.forwardRef(function (props, ref) {
74
74
  _props$wrapper = props.wrapper,
75
75
  WrapperTagName = _props$wrapper === void 0 ? 'div' : _props$wrapper,
76
76
  _props$height = props.height,
77
- propHeight = _props$height === void 0 ? 300 : _props$height,
77
+ propHeight = _props$height === void 0 ? '100%' : _props$height,
78
78
  _props$isStaticItemHe = props.isStaticItemHeight,
79
79
  isStaticItemHeight = _props$isStaticItemHe === void 0 ? true : _props$isStaticItemHe,
80
80
  propItemHeight = props.itemHeight,
@@ -84,7 +84,8 @@ var VirtualList = /*#__PURE__*/React.forwardRef(function (props, ref) {
84
84
  _props$needFiller = props.needFiller,
85
85
  needFiller = _props$needFiller === void 0 ? true : _props$needFiller,
86
86
  outerStyle = props.outerStyle,
87
- restProps = __rest(props, ["style", "className", "children", "data", "itemKey", "threshold", "wrapper", "height", "isStaticItemHeight", "itemHeight", "measureLongestItem", "scrollOptions", "onScroll", "needFiller", "outerStyle"]);
87
+ innerStyle = props.innerStyle,
88
+ restProps = __rest(props, ["style", "className", "children", "data", "itemKey", "threshold", "wrapper", "height", "isStaticItemHeight", "itemHeight", "measureLongestItem", "scrollOptions", "onScroll", "needFiller", "outerStyle", "innerStyle"]);
88
89
  var styleListMaxHeight = style && style.maxHeight || propHeight;
89
90
  var refItemHeightMap = useRef({});
90
91
  var _useState = useState(200),
@@ -507,7 +508,8 @@ var VirtualList = /*#__PURE__*/React.forwardRef(function (props, ref) {
507
508
  }, restProps), isVirtual ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Filler, {
508
509
  height: itemTotalHeight,
509
510
  offset: state.status === 'MEASURE_DONE' ? state.startItemTop : 0,
510
- outerStyle: outerStyle
511
+ outerStyle: outerStyle,
512
+ innerStyle: innerStyle
511
513
  }, renderChildren(_sliceInstanceProperty(data).call(data, state.startIndex, state.endIndex + 1), state.startIndex)), renderLongestItem()) : needFiller ? /*#__PURE__*/React.createElement(Filler, {
512
514
  height: viewportHeight
513
515
  }, renderChildren(data, 0)) : renderChildren(data, 0)));
@@ -3,5 +3,6 @@ export declare const isValidElement: typeof React.isValidElement;
3
3
  declare type AnyObject = Record<any, any>;
4
4
  declare type RenderProps = undefined | AnyObject | ((originProps: AnyObject) => AnyObject | undefined);
5
5
  export declare function replaceElement(element: React.ReactNode, replacement: React.ReactNode, props: RenderProps): React.ReactNode;
6
+ export declare function isFragment(child: any): boolean;
6
7
  export declare function cloneElement(element: React.ReactNode, props?: RenderProps): React.ReactElement;
7
8
  export {};
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.cloneElement = cloneElement;
10
+ exports.isFragment = isFragment;
10
11
  exports.isValidElement = void 0;
11
12
  exports.replaceElement = replaceElement;
12
13
  var React = _interopRequireWildcard(require("react"));
@@ -18,6 +19,9 @@ function replaceElement(element, replacement, props) {
18
19
  if (!isValidElement(element)) return replacement;
19
20
  return /*#__PURE__*/React.cloneElement(element, typeof props === 'function' ? props(element.props || {}) : props);
20
21
  }
22
+ function isFragment(child) {
23
+ return child && isValidElement(child) && child.type === React.Fragment;
24
+ }
21
25
  function cloneElement(element, props) {
22
26
  return replaceElement(element, element, props);
23
27
  }
@@ -43,7 +43,7 @@ var CheckboxGroup = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
43
43
  getPrefixCls = _useContext.getPrefixCls,
44
44
  prefixCls = _useContext.prefixCls,
45
45
  userDefaultProps = _useContext.compDefaultProps;
46
- var CheckboxProps = (0, _utils.getCompProps)('Checkbox', userDefaultProps, props); // 按钮属性需要合并一遍用户定义的默认属性
46
+ var CheckboxProps = (0, _utils.getCompProps)('CheckboxGroup', userDefaultProps, props); // 多选组属性需要合并一遍用户定义的默认属性
47
47
  var checkboxType = CheckboxProps.checkboxType,
48
48
  className = CheckboxProps.className,
49
49
  style = CheckboxProps.style,
@@ -116,6 +116,9 @@
116
116
  .kd-collapse-panel:last-child {
117
117
  border-top: none;
118
118
  }
119
+ .kd-collapse-panel:first-child {
120
+ border-top: var(--kd-c-collapse-border-width, 1px) solid var(--kd-c-collapse-color-border-strong-2, var(--kd-g-color-border-strong-2, #d9d9d9));
121
+ }
119
122
  .kd-collapse-panel {
120
123
  display: -webkit-inline-box;
121
124
  display: -ms-inline-flexbox;
@@ -9,6 +9,9 @@
9
9
  &-panel:last-child {
10
10
  border-top: none;
11
11
  }
12
+ &-panel:first-child {
13
+ border-top: @collapse-border-width solid @collapse-border-color;
14
+ }
12
15
  &-panel {
13
16
  display: inline-flex;
14
17
  flex-direction: column;
@@ -17,6 +17,7 @@ var _ConfigContext = _interopRequireDefault(require("../config-provider/ConfigCo
17
17
  var _utils = require("../_utils");
18
18
  var _menu = require("./menu");
19
19
  var _usePopper = _interopRequireDefault(require("../_utils/usePopper"));
20
+ var _reactNode = require("../_utils/reactNode");
20
21
  function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
23
  var findItem = function findItem(element) {
@@ -71,9 +72,9 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
71
72
  children.props.onBlur && children.props.onBlur(e);
72
73
  handleVisibleChange(false);
73
74
  }
74
- }) : children) : /*#__PURE__*/React.cloneElement(React.Children.only(children), {
75
- ref: children.ref || ref,
76
- className: (0, _classnames.default)("".concat(prefixCls, "-trigger"), children.props.className, {
75
+ }) : children) : /*#__PURE__*/React.cloneElement( /*#__PURE__*/React.isValidElement(children) && !(0, _reactNode.isFragment)(children) ? children : /*#__PURE__*/React.createElement("span", null, children), {
76
+ ref: /*#__PURE__*/React.isValidElement(children) && !(0, _reactNode.isFragment)(children) && children.ref ? children.ref : ref,
77
+ className: (0, _classnames.default)("".concat(prefixCls, "-trigger"), /*#__PURE__*/React.isValidElement(children) && !(0, _reactNode.isFragment)(children) && children.props && children.props.className, {
77
78
  disabled: disabled
78
79
  })
79
80
  });
@@ -83,8 +83,7 @@ var InternalInput = function InternalInput(props, ref) {
83
83
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
84
84
  showNumberMark = _useState4[0],
85
85
  setShowNumberMark = _useState4[1];
86
- var thisInputRef = (0, _react.useRef)();
87
- var inputRef = ref || thisInputRef;
86
+ var inputRef = (0, _react.useRef)();
88
87
  var inputPrefixCls = getPrefixCls(prefixCls, 'input', customPrefixcls); // 按钮样式前缀
89
88
  var addonBefore = others.addonBefore,
90
89
  addonAfter = others.addonAfter;
@@ -163,6 +162,25 @@ var InternalInput = function InternalInput(props, ref) {
163
162
  setShowNumberMark(false);
164
163
  }
165
164
  }, [focused]);
165
+ (0, _react.useImperativeHandle)(ref, function () {
166
+ return {
167
+ input: inputRef.current,
168
+ focus: function focus() {
169
+ var _a;
170
+ setFocused(true);
171
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
172
+ },
173
+ blur: function blur() {
174
+ var _a;
175
+ setFocused(false);
176
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
177
+ },
178
+ select: function select() {
179
+ var _a;
180
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.select();
181
+ }
182
+ };
183
+ });
166
184
  return /*#__PURE__*/_react.default.createElement(_ClearableLabeledInput.default, (0, _extends2.default)({}, inputProps, {
167
185
  handleReset: handleReset,
168
186
  value: value,
@@ -84,6 +84,9 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
84
84
  return true;
85
85
  };
86
86
  (0, _react.useEffect)(function () {
87
+ if (typeof value === 'undefined') {
88
+ return;
89
+ }
87
90
  setInputValue((0, _numberUtil.serialization)(value + ''));
88
91
  }, [value]);
89
92
  var handleEventAttachValue = function handleEventAttachValue(event, value) {
@@ -252,6 +255,9 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
252
255
  inputStatus.current.inputFocused = false;
253
256
  };
254
257
  (0, _react.useEffect)(function () {
258
+ if (typeof value === 'undefined') {
259
+ return;
260
+ }
255
261
  var _inputStatus$current = inputStatus.current,
256
262
  isHandleChange = _inputStatus$current.isHandleChange,
257
263
  inputFocused = _inputStatus$current.inputFocused;