@kdcloudjs/kdesign 1.7.20 → 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 (68) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/kdesign-complete.less +12 -4
  3. package/dist/kdesign.css +13 -5
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +363 -268
  6. package/dist/kdesign.js.map +1 -1
  7. package/dist/kdesign.min.css +3 -3
  8. package/dist/kdesign.min.js +8 -8
  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/config-provider/compDefaultProps.d.ts +2 -0
  16. package/es/config-provider/compDefaultProps.js +3 -1
  17. package/es/dropdown/dropdown.js +4 -3
  18. package/es/input/input.js +21 -3
  19. package/es/input-number/inputNumber.js +6 -0
  20. package/es/menu/menu.js +27 -18
  21. package/es/menu/style/index.css +3 -0
  22. package/es/menu/style/mixin.less +1 -0
  23. package/es/select/select.js +42 -18
  24. package/es/timeline/TimelineItem.js +2 -1
  25. package/es/timeline/style/index.css +2 -3
  26. package/es/timeline/style/index.less +2 -3
  27. package/es/tooltip/tooltip.js +3 -2
  28. package/es/tree/tree.js +68 -57
  29. package/es/tree/treeNode.js +1 -6
  30. package/es/tree-select/interface.d.ts +1 -0
  31. package/es/tree-select/style/index.css +4 -1
  32. package/es/tree-select/style/index.less +5 -1
  33. package/es/tree-select/style/token.less +1 -0
  34. package/es/tree-select/tree-select.js +18 -4
  35. package/es/virtual-list/Filler.d.ts +1 -0
  36. package/es/virtual-list/Filler.js +4 -3
  37. package/es/virtual-list/virtual-list.d.ts +1 -0
  38. package/es/virtual-list/virtual-list.js +5 -3
  39. package/lib/_utils/reactNode.d.ts +1 -0
  40. package/lib/_utils/reactNode.js +4 -0
  41. package/lib/checkbox/group.js +1 -1
  42. package/lib/collapse/style/index.css +3 -0
  43. package/lib/collapse/style/index.less +3 -0
  44. package/lib/config-provider/compDefaultProps.d.ts +2 -0
  45. package/lib/config-provider/compDefaultProps.js +3 -1
  46. package/lib/dropdown/dropdown.js +4 -3
  47. package/lib/input/input.js +20 -2
  48. package/lib/input-number/inputNumber.js +6 -0
  49. package/lib/menu/menu.js +26 -17
  50. package/lib/menu/style/index.css +3 -0
  51. package/lib/menu/style/mixin.less +1 -0
  52. package/lib/select/select.js +41 -17
  53. package/lib/timeline/TimelineItem.js +2 -1
  54. package/lib/timeline/style/index.css +2 -3
  55. package/lib/timeline/style/index.less +2 -3
  56. package/lib/tooltip/tooltip.js +3 -2
  57. package/lib/tree/tree.js +67 -56
  58. package/lib/tree/treeNode.js +1 -6
  59. package/lib/tree-select/interface.d.ts +1 -0
  60. package/lib/tree-select/style/index.css +4 -1
  61. package/lib/tree-select/style/index.less +5 -1
  62. package/lib/tree-select/style/token.less +1 -0
  63. package/lib/tree-select/tree-select.js +20 -6
  64. package/lib/virtual-list/Filler.d.ts +1 -0
  65. package/lib/virtual-list/Filler.js +4 -3
  66. package/lib/virtual-list/virtual-list.d.ts +1 -0
  67. package/lib/virtual-list/virtual-list.js +5 -3
  68. 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;
@@ -446,6 +446,8 @@ declare const compDefaultProps: {
446
446
  showSearch: boolean;
447
447
  switcherIcon: () => JSX.Element;
448
448
  expandOnClickNode: boolean;
449
+ listHeight: number;
450
+ virtual: boolean;
449
451
  };
450
452
  CityPicker: {
451
453
  type: string;
@@ -463,7 +463,9 @@ var compDefaultProps = {
463
463
  type: "arrow-right-solid"
464
464
  });
465
465
  },
466
- expandOnClickNode: false
466
+ expandOnClickNode: false,
467
+ listHeight: 184,
468
+ virtual: true
467
469
  },
468
470
  CityPicker: {
469
471
  type: 'domestic',
@@ -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);
@@ -140,22 +139,29 @@ var InternalSelect = function InternalSelect(props, ref) {
140
139
  var arr = [];
141
140
  _mapInstanceProperty(initValue).call(initValue, function (item) {
142
141
  var _a, _b;
143
- var obj = (realChildren === null || realChildren === void 0 ? void 0 : _findInstanceProperty(realChildren).call(realChildren, function (child) {
142
+ var obj = realChildren === null || realChildren === void 0 ? void 0 : _findInstanceProperty(realChildren).call(realChildren, function (child) {
144
143
  if (child && child.props) {
145
144
  return child.props.value === item;
146
145
  } else {
147
146
  return child.value === item;
148
147
  }
149
- })) || {};
150
- if (options && options.length) {
151
- arr.push({
152
- value: obj === null || obj === void 0 ? void 0 : obj.value,
153
- label: (obj === null || obj === void 0 ? void 0 : obj.label) || (obj === null || obj === void 0 ? void 0 : obj.value)
154
- });
148
+ });
149
+ if (obj) {
150
+ if (options && options.length) {
151
+ arr.push({
152
+ value: obj === null || obj === void 0 ? void 0 : obj.value,
153
+ label: (obj === null || obj === void 0 ? void 0 : obj.label) || (obj === null || obj === void 0 ? void 0 : obj.value)
154
+ });
155
+ } else {
156
+ arr.push({
157
+ value: (_a = obj.props) === null || _a === void 0 ? void 0 : _a.value,
158
+ label: (_b = obj.props) === null || _b === void 0 ? void 0 : _b.children
159
+ });
160
+ }
155
161
  } else {
156
162
  arr.push({
157
- value: (_a = obj.props) === null || _a === void 0 ? void 0 : _a.value,
158
- label: (_b = obj.props) === null || _b === void 0 ? void 0 : _b.children
163
+ value: item,
164
+ label: item
159
165
  });
160
166
  }
161
167
  });
@@ -172,19 +178,22 @@ var InternalSelect = function InternalSelect(props, ref) {
172
178
  if (!isMultiple) {
173
179
  multipleRef.current.selectedVal = initValue; // 默认选中值
174
180
  if (initValue !== undefined) {
175
- var obj = (realChildren === null || realChildren === void 0 ? void 0 : _findInstanceProperty(realChildren).call(realChildren, function (child) {
181
+ var obj = realChildren === null || realChildren === void 0 ? void 0 : _findInstanceProperty(realChildren).call(realChildren, function (child) {
176
182
  var _a;
177
183
  if (child && child.props) {
178
184
  return ((_a = child.props) === null || _a === void 0 ? void 0 : _a.value) === initValue;
179
185
  } else {
180
186
  return (child === null || child === void 0 ? void 0 : child.value) === initValue;
181
187
  }
182
- })) || {};
183
- if (options && options.length) {
184
- setSingleVal(getOptionLabel(obj) || (obj === null || obj === void 0 ? void 0 : obj.value));
188
+ });
189
+ if (obj) {
190
+ if (options && options.length) {
191
+ setSingleVal(getOptionLabel(obj) || (obj === null || obj === void 0 ? void 0 : obj.value));
192
+ } else {
193
+ setSingleVal(getOptionLabel(obj));
194
+ }
185
195
  } else {
186
- // setSingleVal(obj.props?.children)
187
- setSingleVal(getOptionLabel(obj));
196
+ setSingleVal(initValue);
188
197
  }
189
198
  } else {
190
199
  setSingleVal(undefined);
@@ -732,6 +741,21 @@ var InternalSelect = function InternalSelect(props, ref) {
732
741
  (_a = clearRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseup', fn);
733
742
  };
734
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
+ });
735
759
  var _useState13 = useState(isShowSearch ? getActiveIndex(0) : -1),
736
760
  _useState14 = _slicedToArray(_useState13, 2),
737
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;