@kdcloudjs/kdesign 1.7.21 → 1.7.23

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 (114) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/kdesign-complete.less +63 -17
  3. package/dist/kdesign.css +42 -8
  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/button/style/index.css +3 -0
  13. package/es/button/style/index.less +3 -3
  14. package/es/button/style/mixin.less +2 -1
  15. package/es/button/style/token.less +3 -0
  16. package/es/checkbox/group.js +1 -1
  17. package/es/checkbox/style/index.css +1 -0
  18. package/es/checkbox/style/index.less +1 -0
  19. package/es/checkbox/style/token.less +1 -0
  20. package/es/collapse/style/index.css +3 -0
  21. package/es/collapse/style/index.less +3 -0
  22. package/es/dropdown/dropdown.js +4 -3
  23. package/es/filter/style/index.css +6 -0
  24. package/es/filter/style/index.less +7 -0
  25. package/es/filter/style/token.less +4 -0
  26. package/es/form/style/index.css +1 -1
  27. package/es/form/style/index.less +1 -1
  28. package/es/form/style/token.less +1 -1
  29. package/es/input/input.js +21 -3
  30. package/es/input-number/inputNumber.js +6 -0
  31. package/es/menu/menu.js +27 -18
  32. package/es/menu/style/index.css +5 -1
  33. package/es/menu/style/mixin.less +3 -1
  34. package/es/menu/style/token.less +2 -0
  35. package/es/radio/style/index.css +7 -0
  36. package/es/radio/style/index.less +5 -1
  37. package/es/radio/style/token.less +3 -0
  38. package/es/search/style/index.css +1 -0
  39. package/es/search/style/index.less +1 -0
  40. package/es/search/style/token.less +1 -0
  41. package/es/select/select.js +17 -3
  42. package/es/tag/style/index.css +6 -0
  43. package/es/tag/style/index.less +3 -3
  44. package/es/tag/style/mixin.less +3 -1
  45. package/es/tag/style/token.less +2 -0
  46. package/es/timeline/TimelineItem.js +2 -1
  47. package/es/timeline/style/index.css +4 -3
  48. package/es/timeline/style/index.less +5 -3
  49. package/es/timeline/style/token.less +2 -0
  50. package/es/tooltip/tooltip.js +3 -2
  51. package/es/transfer/style/index.css +2 -2
  52. package/es/transfer/style/index.less +2 -2
  53. package/es/transfer/style/token.less +1 -0
  54. package/es/tree/style/index.css +2 -0
  55. package/es/tree/style/index.less +2 -0
  56. package/es/tree/style/token.less +2 -0
  57. package/es/tree/tree.js +8 -1
  58. package/es/virtual-list/Filler.d.ts +1 -0
  59. package/es/virtual-list/Filler.js +4 -3
  60. package/es/virtual-list/virtual-list.d.ts +1 -0
  61. package/es/virtual-list/virtual-list.js +5 -3
  62. package/lib/_utils/reactNode.d.ts +1 -0
  63. package/lib/_utils/reactNode.js +4 -0
  64. package/lib/button/style/index.css +3 -0
  65. package/lib/button/style/index.less +3 -3
  66. package/lib/button/style/mixin.less +2 -1
  67. package/lib/button/style/token.less +3 -0
  68. package/lib/checkbox/group.js +1 -1
  69. package/lib/checkbox/style/index.css +1 -0
  70. package/lib/checkbox/style/index.less +1 -0
  71. package/lib/checkbox/style/token.less +1 -0
  72. package/lib/collapse/style/index.css +3 -0
  73. package/lib/collapse/style/index.less +3 -0
  74. package/lib/dropdown/dropdown.js +4 -3
  75. package/lib/filter/style/index.css +6 -0
  76. package/lib/filter/style/index.less +7 -0
  77. package/lib/filter/style/token.less +4 -0
  78. package/lib/form/style/index.css +1 -1
  79. package/lib/form/style/index.less +1 -1
  80. package/lib/form/style/token.less +1 -1
  81. package/lib/input/input.js +20 -2
  82. package/lib/input-number/inputNumber.js +6 -0
  83. package/lib/menu/menu.js +26 -17
  84. package/lib/menu/style/index.css +5 -1
  85. package/lib/menu/style/mixin.less +3 -1
  86. package/lib/menu/style/token.less +2 -0
  87. package/lib/radio/style/index.css +7 -0
  88. package/lib/radio/style/index.less +5 -1
  89. package/lib/radio/style/token.less +3 -0
  90. package/lib/search/style/index.css +1 -0
  91. package/lib/search/style/index.less +1 -0
  92. package/lib/search/style/token.less +1 -0
  93. package/lib/select/select.js +16 -2
  94. package/lib/tag/style/index.css +6 -0
  95. package/lib/tag/style/index.less +3 -3
  96. package/lib/tag/style/mixin.less +3 -1
  97. package/lib/tag/style/token.less +2 -0
  98. package/lib/timeline/TimelineItem.js +2 -1
  99. package/lib/timeline/style/index.css +4 -3
  100. package/lib/timeline/style/index.less +5 -3
  101. package/lib/timeline/style/token.less +2 -0
  102. package/lib/tooltip/tooltip.js +3 -2
  103. package/lib/transfer/style/index.css +2 -2
  104. package/lib/transfer/style/index.less +2 -2
  105. package/lib/transfer/style/token.less +1 -0
  106. package/lib/tree/style/index.css +2 -0
  107. package/lib/tree/style/index.less +2 -0
  108. package/lib/tree/style/token.less +2 -0
  109. package/lib/tree/tree.js +8 -1
  110. package/lib/virtual-list/Filler.d.ts +1 -0
  111. package/lib/virtual-list/Filler.js +4 -3
  112. package/lib/virtual-list/virtual-list.d.ts +1 -0
  113. package/lib/virtual-list/virtual-list.js +5 -3
  114. 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
  }
@@ -242,6 +242,7 @@
242
242
  line-height: calc(var(--kd-c-button-sizing-height-small, 24px) - (var(--kd-c-button-spacing-padding-vertical-small, 3px) * 2) - (var(--kd-c-button-sizing-border, 1px) * 2));
243
243
  font-size: var(--kd-c-button-font-size-small, var(--kd-g-font-size-small, 12px));
244
244
  padding: var(--kd-c-button-spacing-padding-vertical-small, 3px) var(--kd-c-button-spacing-padding-horizontal-small, 8px);
245
+ max-width: var(--kd-c-button-sizing-max-width-small);
245
246
  }
246
247
  .kd-btn-size-small.kd-btn-icon-only {
247
248
  font-size: var(--kd-c-button-icon-font-size-small, 14px);
@@ -265,6 +266,7 @@
265
266
  line-height: calc(var(--kd-c-button-sizing-height-middle, 28px) - (var(--kd-c-button-spacing-padding-vertical-middle, 5px) * 2) - (var(--kd-c-button-sizing-border, 1px) * 2));
266
267
  font-size: var(--kd-c-button-font-size-middle, var(--kd-g-font-size-small, 12px));
267
268
  padding: var(--kd-c-button-spacing-padding-vertical-middle, 5px) var(--kd-c-button-spacing-padding-horizontal-middle, 8px);
269
+ max-width: var(--kd-c-button-sizing-max-width-middle);
268
270
  }
269
271
  .kd-btn-size-middle.kd-btn-icon-only {
270
272
  font-size: var(--kd-c-button-icon-font-size-middle, 16px);
@@ -288,6 +290,7 @@
288
290
  line-height: calc(var(--kd-c-button-sizing-height-large, 32px) - (var(--kd-c-button-spacing-padding-vertical-large, 6px) * 2) - (var(--kd-c-button-sizing-border, 1px) * 2));
289
291
  font-size: var(--kd-c-button-font-size-large, var(--kd-g-font-size-large, 16px));
290
292
  padding: var(--kd-c-button-spacing-padding-vertical-large, 6px) var(--kd-c-button-spacing-padding-horizontal-large, 8px);
293
+ max-width: var(--kd-c-button-sizing-max-width-large);
291
294
  }
292
295
  .kd-btn-size-large.kd-btn-icon-only {
293
296
  font-size: var(--kd-c-button-icon-font-size-large, 18px);
@@ -110,7 +110,7 @@
110
110
 
111
111
  // 小号尺寸按钮
112
112
  &-size-small {
113
- .btn-size(@btn-small-height, @btn-small-font-size, @btn-small-padding-vertical, @btn-small-padding-horizontal, @btn-small-min-width);
113
+ .btn-size(@btn-small-height, @btn-small-font-size, @btn-small-padding-vertical, @btn-small-padding-horizontal, @btn-small-min-width, @btn-small-max-width);
114
114
  &.@{btn-prefix-cls}-icon-only {
115
115
  font-size: @btn-icon-small-font-size;
116
116
  padding: 0 @btn-icon-padding-horizontal;
@@ -126,7 +126,7 @@
126
126
 
127
127
  // 中号尺寸按钮
128
128
  &-size-middle {
129
- .btn-size(@btn-middle-height, @btn-middle-font-size, @btn-middle-padding-vertical, @btn-middle-padding-horizontal, @btn-middle-min-width);
129
+ .btn-size(@btn-middle-height, @btn-middle-font-size, @btn-middle-padding-vertical, @btn-middle-padding-horizontal, @btn-middle-min-width, @btn-middle-max-width);
130
130
  &.@{btn-prefix-cls}-icon-only {
131
131
  font-size: @btn-icon-middle-font-size;
132
132
  padding: 0 @btn-icon-padding-horizontal;
@@ -142,7 +142,7 @@
142
142
 
143
143
  // 大号尺寸按钮
144
144
  &-size-large {
145
- .btn-size(@btn-large-height, @btn-large-font-size, @btn-large-padding-vertical, @btn-large-padding-horizontal, @btn-large-min-width);
145
+ .btn-size(@btn-large-height, @btn-large-font-size, @btn-large-padding-vertical, @btn-large-padding-horizontal, @btn-large-min-width, @btn-large-max-width);
146
146
  &.@{btn-prefix-cls}-icon-only {
147
147
  font-size: @btn-icon-large-font-size;
148
148
  padding: 0 @btn-icon-padding-horizontal;
@@ -30,12 +30,13 @@
30
30
  color: @color;
31
31
  }
32
32
  // 各个按钮尺寸的样式Mixins
33
- .btn-size(@height, @font-size, @padding-vertical, @padding-horizontal, @min-width) {
33
+ .btn-size(@height, @font-size, @padding-vertical, @padding-horizontal, @min-width,@max-width) {
34
34
  height: @height;
35
35
  min-width: @min-width;
36
36
  line-height: calc(@height - (@padding-vertical * 2) - (@btn-border-width * 2));
37
37
  font-size: @font-size;
38
38
  padding: @padding-vertical @padding-horizontal;
39
+ max-width: @max-width;
39
40
  }
40
41
  // 圆形按钮不同尺寸的样式Mixins
41
42
  .btn-shape-circle-width(@width) {
@@ -88,11 +88,14 @@
88
88
  @btn-border-width: var(~'@{button-custom-prefix}-sizing-border', 1px);
89
89
  @btn-small-height: var(~'@{button-custom-prefix}-sizing-height-small', 24px); // 小号 高度
90
90
  @btn-small-min-width: var(~'@{button-custom-prefix}-sizing-min-width-small', 60px); // 小号 最小宽度
91
+ @btn-small-max-width: var(~'@{button-custom-prefix}-sizing-max-width-small'); // 小号 最大宽度
91
92
  @btn-middle-height: var(~'@{button-custom-prefix}-sizing-height-middle', 28px); // 中号 高度 高度配置
92
93
  @btn-middle-min-width: var(~'@{button-custom-prefix}-sizing-min-width-middle', 60px); // 中号 最小宽度
94
+ @btn-middle-max-width: var(~'@{button-custom-prefix}-sizing-max-width-middle'); // 中号 最大宽度
93
95
  @btn-large-height: var(~'@{button-custom-prefix}-sizing-height-large', 32px); // 大号 高度
94
96
  @btn-middle-max-width: var(~'@{button-custom-prefix}-sizing-max-width-middle'); // 中号 最大宽度
95
97
  @btn-large-min-width: var(~'@{button-custom-prefix}-sizing-min-width-large', 80px); // 大号 最小宽度
98
+ @btn-large-max-width: var(~'@{button-custom-prefix}-sizing-max-width-large'); // 大号 最大宽度
96
99
  @btn-group-dropdown-item-height: var(~'@{button-custom-prefix}--group-dropdown-item-height', 30px);
97
100
  @btn-group-dropdown-min-width: var(~'@{button-custom-prefix}-group-dropdown-min-width', 80px);
98
101
 
@@ -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,
@@ -162,6 +162,7 @@
162
162
  overflow: hidden;
163
163
  white-space: nowrap;
164
164
  text-overflow: ellipsis;
165
+ max-width: var(--kd-c-checkbox-default-input-label-max-width);
165
166
  }
166
167
  .kd-checkbox-children .kd-input-underline {
167
168
  background-color: transparent;
@@ -44,6 +44,7 @@
44
44
  overflow: hidden;
45
45
  white-space: nowrap;
46
46
  text-overflow: ellipsis;
47
+ max-width: @checkbox-default-input-label-max-width;
47
48
 
48
49
  .kd-input-underline {
49
50
  background-color: transparent;
@@ -33,6 +33,7 @@
33
33
  @checkbox-default-input-height: var(~'@{checkbox-prefix}-default-input-sizing-height', 14px); // 勾选输入框高度
34
34
  @checkbox-default-input-width: var(~'@{checkbox-prefix}-default-input-sizing-width', 14px); // 勾选输入框宽度
35
35
  @checkbox-default-input-border-width: var(~'@{checkbox-prefix}-default-input-border-width', 1px); // 勾选输入框边框大小 不需要
36
+ @checkbox-default-input-label-max-width: var(~'@{checkbox-prefix}-default-input-label-max-width'); // 勾选输入框便签文本最大宽度,默认为未设置。
36
37
  @checkbox-square-triangle-height: var(~'@{checkbox-prefix}-square-triangle-sizing-height', 18px); // 边框类型右下角三角高度
37
38
  @checkbox-square-triangle-width: var(~'@{checkbox-prefix}-square-triangle-sizing-width', 18px); // 边框类型右下角三角宽度
38
39
  @checkbox-default-indeterminate-square: var(~'@{checkbox-prefix}-default-indeterminate-sizing-square', 6px); // 半选框的大小
@@ -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
  });
@@ -145,6 +145,7 @@
145
145
  white-space: nowrap;
146
146
  overflow: hidden;
147
147
  text-overflow: ellipsis;
148
+ display: block;
148
149
  }
149
150
  .kd-filter .kd-filter-header-search {
150
151
  min-width: 200px;
@@ -240,6 +241,7 @@
240
241
  padding: 11px 0 10px;
241
242
  color: var(--kd-g-color-text-third, #999);
242
243
  line-height: 18px;
244
+ width: var(--kd-c-filter-body-condition-label-width);
243
245
  }
244
246
  .kd-filter .kd-filter-body-condition-options {
245
247
  display: -webkit-box;
@@ -269,6 +271,10 @@
269
271
  border: 1px solid transparent;
270
272
  cursor: pointer;
271
273
  white-space: nowrap;
274
+ max-width: var(--kd-c-filter-body-condition-option-max-width);
275
+ overflow: hidden;
276
+ display: inline-block;
277
+ text-overflow: ellipsis;
272
278
  }
273
279
  .kd-filter .kd-filter-body-condition-option:not(:last-child) {
274
280
  margin-right: 24px;
@@ -36,6 +36,7 @@
36
36
  &-item-text {
37
37
  max-width: 224px;
38
38
  .ellipsis;
39
+ display: block;
39
40
  }
40
41
  }
41
42
 
@@ -130,6 +131,7 @@
130
131
  padding: 11px 0 10px;
131
132
  color: @color-text-third;
132
133
  line-height: 18px;
134
+ width: @filter-body-condition-label-width;
133
135
  }
134
136
 
135
137
  &-options {
@@ -154,6 +156,11 @@
154
156
  border: 1px solid transparent;
155
157
  cursor: pointer;
156
158
  white-space: nowrap;
159
+ max-width: @filter-body-condition-option-max-width;
160
+ overflow: hidden;
161
+ display: inline-block;
162
+ text-overflow: ellipsis;
163
+
157
164
 
158
165
  &:not(:last-child) {
159
166
  margin-right: 24px;
@@ -26,3 +26,7 @@
26
26
  @filter-condition-label-font-size: var(~'@{filter-custom-prefix}-condition-label-font-size', @font-size-middle);
27
27
  @filter-handle-font-size: var(~'@{filter-custom-prefix}-handle-font-size', @font-size-middle);
28
28
  @filter-body-tabs-item-font-size: var(~'@{filter-custom-prefix}-body-tabs-item-font-size', @font-size-middle);
29
+
30
+ //sizing
31
+ @filter-body-condition-label-width: var(~'@{filter-custom-prefix}-body-condition-label-width');
32
+ @filter-body-condition-option-max-width: var(~'@{filter-custom-prefix}-body-condition-option-max-width');
@@ -147,7 +147,7 @@
147
147
  flex-direction: column;
148
148
  }
149
149
  .kd-form-field-vertical .kd-form-field-label {
150
- margin-bottom: 5px;
150
+ margin-bottom: var(--kd-c-form-field-label-spacing-margin-bottom, 5px);
151
151
  }
152
152
  .kd-form-field-hidden {
153
153
  display: none !important;
@@ -39,7 +39,7 @@
39
39
  flex-direction: column;
40
40
 
41
41
  .@{field-label-cls} {
42
- margin-bottom: 5px;
42
+ margin-bottom: @form-field-label-spacing-margin-bottom;
43
43
  }
44
44
  }
45
45
 
@@ -19,4 +19,4 @@
19
19
  @form-field-spacing-margin-bottom: var(~'@{form-prefix}-field-spacing-margin-bottom', 22px);
20
20
  @form-field-message-spacing-padding-horizontal: var(~'@{form-prefix}-field-message-spacing-padding-horizontal', 2px);
21
21
  @form-field-message-spacing-padding-vertical: var(~'@{form-prefix}-field-message-spacing-padding-vertical', 8px);
22
-
22
+ @form-field-label-spacing-margin-bottom: var(~'@{form-prefix}-field-label-spacing-margin-bottom', 5px);
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;
@@ -191,7 +192,8 @@
191
192
  position: relative;
192
193
  width: 100%;
193
194
  height: 100%;
194
- min-width: 138px;
195
+ min-width: var(--kd-c-menu-sizing-min-width, 138px);
196
+ max-width: var(--kd-c-menu-sizing-max-width);
195
197
  background-color: var(--kd-c-menu-color-background, #343848);
196
198
  color: var(--kd-c-menu-sub-color-text, rgba(255, 255, 255, 0.65));
197
199
  }
@@ -534,6 +536,7 @@
534
536
  color: var(--kd-c-menu-sub-color-text-hover, var(--kd-g-color-white, #fff));
535
537
  }
536
538
  .kd-menu-popper.hidden {
539
+ display: none;
537
540
  opacity: 0;
538
541
  visibility: hidden;
539
542
  -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 +578,7 @@
575
578
  transition-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
576
579
  }
577
580
  .kd-menu-popper .kd-menu-submenu-sub-hide {
581
+ display: none;
578
582
  opacity: 0;
579
583
  visibility: hidden;
580
584
  -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;
@@ -10,7 +10,8 @@
10
10
  position: relative;
11
11
  width: 100%;
12
12
  height: 100%;
13
- min-width: 138px;
13
+ min-width: @menu-min-width;
14
+ max-width: @menu-max-width;
14
15
  background-color: @menu-color-background;
15
16
  color: @menu-sub-color;
16
17
  }
@@ -79,6 +80,7 @@
79
80
  }
80
81
 
81
82
  .menu-hidden {
83
+ display: none;
82
84
  opacity: 0;
83
85
  visibility: hidden;
84
86
  animation: kdZoomTopLeftOut calc(@menu-motion-duration - 0.1s) cubic-bezier(0, .4, .4, 1) forwards;
@@ -25,6 +25,8 @@
25
25
  @menu-motion-duration: var(~'@{menu-prefix}-motion-duration', @duration-promptly);
26
26
 
27
27
  // sizing
28
+ @menu-max-width: var(~'@{menu-prefix}-sizing-max-width');
29
+ @menu-min-width: var(~'@{menu-prefix}-sizing-min-width',138px);
28
30
  @menu-item-height: var(~'@{menu-prefix}-item-sizing-height', 50px);
29
31
 
30
32
  // z-index
@@ -125,6 +125,8 @@
125
125
  vertical-align: middle;
126
126
  color: var(--kd-c-radio-color-font, var(--kd-g-color-text-primary, #212121));
127
127
  font-size: var(--kd-c-radio-font-size, var(--kd-g-font-size-small, 12px));
128
+ max-width: var(--kd-c-radio-default-label-max-width);
129
+ overflow: hidden;
128
130
  }
129
131
  .kd-radio::before {
130
132
  position: absolute;
@@ -256,6 +258,7 @@
256
258
  border: var(--kd-c-radio-radius-border-width, 1px) solid var(--kd-c-radio-color-border, var(--kd-g-color-border-strong, #d9d9d9));
257
259
  -webkit-transition: all 0.3s;
258
260
  transition: all 0.3s;
261
+ max-width: var(--kd-c-radio-square-label-max-width);
259
262
  }
260
263
  .kd-radio-square::after {
261
264
  position: absolute;
@@ -348,6 +351,9 @@
348
351
  list-style: none;
349
352
  -webkit-font-feature-settings: 'tnum';
350
353
  font-feature-settings: 'tnum';
354
+ white-space: nowrap;
355
+ overflow: hidden;
356
+ text-overflow: ellipsis;
351
357
  position: relative;
352
358
  display: inline-block;
353
359
  height: var(--kd-c-radio-square-sizing-height, 32px);
@@ -365,6 +371,7 @@
365
371
  border-left: none;
366
372
  -webkit-transition: all 0.3s;
367
373
  transition: all 0.3s;
374
+ max-width: var(--kd-c-radio-button-label-max-width);
368
375
  }
369
376
  .kd-radio-button:first-child {
370
377
  border-radius: 2px 0 0 2px;
@@ -22,6 +22,8 @@
22
22
  vertical-align: middle;
23
23
  color: @radio-font-color;
24
24
  font-size: @radio-font-size;
25
+ max-width: @radio-default-label-max-width;
26
+ overflow: hidden;
25
27
 
26
28
  &::before {
27
29
  position: absolute;
@@ -152,6 +154,7 @@
152
154
  border-radius: @radius-size;
153
155
  border: @radio-border-width solid @radio-color-border;
154
156
  transition: all @transition-duration;
157
+ max-width: @radio-square-label-max-width;
155
158
 
156
159
  &::after {
157
160
  position: absolute;
@@ -241,7 +244,7 @@
241
244
  // 按钮类型(切换按钮)
242
245
  .@{radio-button-prefix-cls} {
243
246
  .reset-component();
244
-
247
+ .ellipsis();
245
248
  // 默认状态
246
249
  position: relative;
247
250
  display: inline-block;
@@ -259,6 +262,7 @@
259
262
  border: @radio-border-width solid @radio-color-border;
260
263
  border-left: none;
261
264
  transition: all @transition-duration;
265
+ max-width: @radio-button-label-max-width;
262
266
 
263
267
  &:first-child {
264
268
  border-radius: @radius-size 0 0 @radius-size;
@@ -22,6 +22,9 @@
22
22
  // sizing
23
23
  @radio-circle-size:var(~'@{radio-prefix}-square-sizing-width-height',14px);//单选图标大小
24
24
  @radio-square-height: var(~'@{radio-prefix}-square-sizing-height',32px);//单选框 高度
25
+ @radio-default-label-max-width: var(~'@{radio-prefix}-default-label-max-width');//单选默认模式 最大宽度
26
+ @radio-square-label-max-width: var(~'@{radio-prefix}-square-label-max-width');//单选框模式 最大宽度
27
+ @radio-button-label-max-width: var(~'@{radio-prefix}-button-label-max-width');//单选按 最大宽度
25
28
 
26
29
  // spacing
27
30
  @radio-margin-right: var(~'@{radio-prefix}-spacing-margin-right',8px);
@@ -335,6 +335,7 @@
335
335
  overflow: hidden;
336
336
  white-space: nowrap;
337
337
  text-overflow: ellipsis;
338
+ max-width: var(--kd-c-search-tag-sizing-max-width);
338
339
  }
339
340
  .kd-quick-search-selection-overflow-item-del {
340
341
  height: 14px;
@@ -140,6 +140,7 @@
140
140
  padding: 0 4px;
141
141
  align-self: center;
142
142
  .ellipsis();
143
+ max-width: @search-tag-max-width;
143
144
  }
144
145
  &-del {
145
146
  height: 14px;
@@ -14,6 +14,7 @@
14
14
  @search-panel-height: var(~'@{search-prefix}-panel-sizing-height', 60px);
15
15
  @quick-search-dropdown-option-height: var(~'@{search-prefix}-dropdown-option-sizing-height', 32px);
16
16
  @search-sizing-border-width: var(~'@{search-prefix}-sizing-border-width', 1px);
17
+ @search-tag-max-width: var(~'@{search-prefix}-tag-sizing-max-width');
17
18
 
18
19
  // color
19
20
  @search-icon-color: var(~'@{search-prefix}-icon-color', #B2B2B2);
@@ -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],