@kdcloudjs/kdesign 1.7.16 → 1.7.18

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 (56) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/kdesign-complete.less +35 -19
  3. package/dist/kdesign.css +28 -17
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +198 -135
  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/card/card.js +27 -17
  11. package/es/carousel/carousel.js +3 -2
  12. package/es/carousel/slideList.d.ts +1 -0
  13. package/es/carousel/slideList.js +5 -2
  14. package/es/cascader/cascader.js +59 -60
  15. package/es/cascader/style/index.css +16 -6
  16. package/es/cascader/style/index.less +20 -6
  17. package/es/color-picker/color-picker-panel.js +4 -3
  18. package/es/color-picker/color-picker.js +4 -2
  19. package/es/color-picker/interface.d.ts +1 -0
  20. package/es/color-picker/style/index.css +4 -1
  21. package/es/color-picker/style/index.less +5 -1
  22. package/es/dropdown/dropdown.js +21 -8
  23. package/es/dropdown/style/index.css +3 -0
  24. package/es/dropdown/style/index.less +4 -0
  25. package/es/filter/scheme.js +2 -1
  26. package/es/filter/style/index.css +2 -1
  27. package/es/filter/style/index.less +3 -2
  28. package/es/input/ClearableLabeledInput.js +9 -1
  29. package/es/select/option.js +6 -2
  30. package/es/select/select.js +32 -14
  31. package/es/select/style/index.css +2 -8
  32. package/es/select/style/index.less +3 -10
  33. package/lib/card/card.js +27 -17
  34. package/lib/carousel/carousel.js +3 -2
  35. package/lib/carousel/slideList.d.ts +1 -0
  36. package/lib/carousel/slideList.js +5 -2
  37. package/lib/cascader/cascader.js +58 -59
  38. package/lib/cascader/style/index.css +16 -6
  39. package/lib/cascader/style/index.less +20 -6
  40. package/lib/color-picker/color-picker-panel.js +4 -3
  41. package/lib/color-picker/color-picker.js +4 -2
  42. package/lib/color-picker/interface.d.ts +1 -0
  43. package/lib/color-picker/style/index.css +4 -1
  44. package/lib/color-picker/style/index.less +5 -1
  45. package/lib/dropdown/dropdown.js +21 -8
  46. package/lib/dropdown/style/index.css +3 -0
  47. package/lib/dropdown/style/index.less +4 -0
  48. package/lib/filter/scheme.js +2 -1
  49. package/lib/filter/style/index.css +2 -1
  50. package/lib/filter/style/index.less +3 -2
  51. package/lib/input/ClearableLabeledInput.js +8 -0
  52. package/lib/select/option.js +6 -2
  53. package/lib/select/select.js +32 -14
  54. package/lib/select/style/index.css +2 -8
  55. package/lib/select/style/index.less +3 -10
  56. package/package.json +1 -1
@@ -108,9 +108,9 @@
108
108
  /** 浮层箭头样式 **/
109
109
  .kd-cascader-picker {
110
110
  position: relative;
111
- display: inline-block;
112
111
  outline: none;
113
112
  cursor: pointer;
113
+ background: var(--kd-c-cascader-color-background, var(--kd-g-color-white, #fff));
114
114
  }
115
115
  .kd-cascader-picker:focus > .kd-cascader-picker-input {
116
116
  border-color: var(--kd-c-cascader-color-active, #999);
@@ -139,7 +139,7 @@
139
139
  left: 0;
140
140
  width: 100%;
141
141
  height: 20px;
142
- padding: 0 24px 0 9px;
142
+ padding: 0 24px 0 0;
143
143
  line-height: 20px;
144
144
  -webkit-transform: translateY(-50%);
145
145
  transform: translateY(-50%);
@@ -169,7 +169,7 @@
169
169
  -webkit-transition: all 0.2s;
170
170
  transition: all 0.2s;
171
171
  }
172
- .kd-cascader-picker.allowClear:hover > .kd-cascader-picker-close {
172
+ .kd-cascader-picker.allowClear:hover .kd-cascader-picker-close {
173
173
  opacity: 1;
174
174
  visibility: visible;
175
175
  -webkit-transition: all 0.2s;
@@ -186,7 +186,7 @@
186
186
  .kd-cascader-picker-close {
187
187
  position: absolute;
188
188
  top: 50%;
189
- right: 9px;
189
+ right: 0;
190
190
  opacity: 0;
191
191
  cursor: pointer;
192
192
  visibility: hidden;
@@ -278,11 +278,20 @@
278
278
  .kd-cascader-menus .kd-empty {
279
279
  padding: 10px 0 20px;
280
280
  }
281
- .kd-cascader-bordered {
281
+ .kd-cascader-bordered:not(.kd-cascader-multiple) .kd-cascader-picker-label {
282
+ padding-left: 9px;
283
+ }
284
+ .kd-cascader-bordered:not(.kd-cascader-multiple) .kd-cascader-picker-close {
285
+ right: 10px;
286
+ }
287
+ .kd-cascader-bordered.kd-cascader-multiple {
282
288
  border: 1px solid #d9d9d9;
283
- padding-left: 8px !important;
289
+ padding-left: 8px;
284
290
  border-radius: 2px;
285
291
  }
292
+ .kd-cascader-bordered.kd-cascader-multiple .kd-cascader-suffix {
293
+ right: 9px;
294
+ }
286
295
  .kd-cascader-multiple {
287
296
  padding: 1px 28px 1px 0;
288
297
  -webkit-transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
@@ -301,6 +310,7 @@
301
310
  overflow-x: hidden;
302
311
  position: relative;
303
312
  border-bottom: 1px solid #d9d9d9;
313
+ background: var(--kd-c-cascader-color-background, var(--kd-g-color-white, #fff));
304
314
  }
305
315
  .kd-cascader-multiple-wrapper {
306
316
  display: -webkit-box;
@@ -8,9 +8,9 @@
8
8
 
9
9
  .@{cascader-picker-prefix-cls} {
10
10
  position: relative;
11
- display: inline-block;
12
11
  outline: none;
13
12
  cursor: pointer;
13
+ background: @cascader-bg-color;
14
14
 
15
15
  &:focus > &-input {
16
16
  border-color: @cascader-active-color;
@@ -47,7 +47,7 @@
47
47
  left: 0;
48
48
  width: 100%;
49
49
  height: 20px;
50
- padding: 0 24px 0 9px;
50
+ padding: 0 24px 0 0;
51
51
  line-height: 20px;
52
52
  transform: translateY(-50%);
53
53
  .ellipsis;
@@ -78,7 +78,7 @@
78
78
  }
79
79
 
80
80
  &.allowClear:hover {
81
- > .@{cascader-picker-prefix-cls}-close {
81
+ .@{cascader-picker-prefix-cls}-close {
82
82
  opacity: 1;
83
83
  visibility: visible;
84
84
  transition: all 0.2s;
@@ -95,7 +95,7 @@
95
95
  &-close {
96
96
  position: absolute;
97
97
  top: 50%;
98
- right: 9px;
98
+ right: 0;
99
99
  opacity: 0;
100
100
  cursor: pointer;
101
101
  visibility: hidden;
@@ -183,10 +183,23 @@
183
183
  }
184
184
 
185
185
  .@{kd-prefix}-cascader {
186
- &-bordered {
186
+ &-bordered:not(.@{kd-prefix}-cascader-multiple) {
187
+ .@{cascader-picker-prefix-cls}-label {
188
+ padding-left: 9px;
189
+ }
190
+ .@{cascader-picker-prefix-cls}-close {
191
+ right: 10px;
192
+ }
193
+ }
194
+
195
+ &-bordered&-multiple {
187
196
  border: 1px solid #d9d9d9;
188
- padding-left: 8px !important;
197
+ padding-left: 8px;
189
198
  border-radius: 2px;
199
+
200
+ .@{kd-prefix}-cascader-suffix {
201
+ right: 9px;
202
+ }
190
203
  }
191
204
 
192
205
  &-multiple {
@@ -203,6 +216,7 @@
203
216
  overflow-x: hidden;
204
217
  position: relative;
205
218
  border-bottom: 1px solid #d9d9d9;
219
+ background: @cascader-bg-color;
206
220
  }
207
221
 
208
222
  &-multiple-wrapper {
@@ -55,6 +55,7 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
55
55
  showColorTransfer = props.showColorTransfer,
56
56
  showPresetColor = props.showPresetColor,
57
57
  showColorPickerBox = props.showColorPickerBox,
58
+ showColorPickerPanel = props.showColorPickerPanel,
58
59
  value = props.value;
59
60
  var panelInputRef = (0, _react.useRef)(null);
60
61
  var panelClsRef = (0, _react.useRef)(null);
@@ -69,7 +70,7 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
69
70
  var panelFollowThemeCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-panel-switch"));
70
71
  var panelInputCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-panel-input"), (0, _defineProperty2.default)({}, "".concat(colorPickerPrefixCls, "-panel-input-no-recommend"), !showPresetColor));
71
72
  var transparentCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-panel-transparent"));
72
- var colorDivContainerCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-panel-colorDivContainer"));
73
+ var colorDivContainerCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-panel-colorDivContainer"), (0, _defineProperty2.default)({}, "".concat(colorPickerPrefixCls, "-panel-colorDivContainer-unset-color"), (presetColor === null || presetColor === void 0 ? void 0 : presetColor.length) === 0));
73
74
  var colorLiClick = function colorLiClick(index, colorValue) {
74
75
  var formatArr = (0, _colorFormat.colorFormat)(colorValue, alpha);
75
76
  var formatValue = (0, _convertLetters.toLowerCase)(formatArr[(0, _colorFormat.valOfCorrespondingType)(currentColorType)].value);
@@ -185,7 +186,7 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
185
186
  (0, _useOnClickOutside.default)([panelClsRef, inputRef], function () {
186
187
  setShowPanel(false);
187
188
  });
188
- return /*#__PURE__*/_react.default.createElement("div", {
189
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showColorPickerPanel && /*#__PURE__*/_react.default.createElement("div", {
189
190
  className: panelCls,
190
191
  ref: panelClsRef
191
192
  }, /*#__PURE__*/_react.default.createElement(_reactColor.ChromePicker, {
@@ -242,7 +243,7 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
242
243
  'square-click': clickedColorIndex === i
243
244
  })
244
245
  }));
245
- })));
246
+ }))));
246
247
  };
247
248
  ColorPickerPanel.displayName = 'ColorPickerPanel';
248
249
  var _default = ColorPickerPanel;
@@ -91,6 +91,7 @@ var ColorPicker = function ColorPicker(props) {
91
91
  var containerCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-container"));
92
92
  var inputCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-input"), className);
93
93
  var inputRef = (0, _react.useRef)(null);
94
+ var showColorPickerPanel = showColorTransfer || typeof showPresetColor === 'boolean' && showPresetColor && (presetColor === null || presetColor === void 0 ? void 0 : presetColor.length) || typeof showPresetColor === 'undefined' || (functionalColor === null || functionalColor === void 0 ? void 0 : functionalColor.length) && showSwitch || (showColorPickerBox === null || showColorPickerBox === void 0 ? void 0 : showColorPickerBox.showBox) || (showColorPickerBox === null || showColorPickerBox === void 0 ? void 0 : showColorPickerBox.showHue) || (showColorPickerBox === null || showColorPickerBox === void 0 ? void 0 : showColorPickerBox.showOpacity);
94
95
  var setIconColor = function setIconColor(value) {
95
96
  value === functionalColorName ? setIsFollow(true) : setIsFollow(false);
96
97
  var inpValue = value === functionalColorName ? functionalColor : value;
@@ -148,7 +149,7 @@ var ColorPicker = function ColorPicker(props) {
148
149
  style: {
149
150
  backgroundColor: "".concat(colTypeArr[2].value || _defaultColor.defaultSystemColor)
150
151
  }
151
- }, /*#__PURE__*/_react.default.createElement(_index.Icon, {
152
+ }, showColorPickerPanel && /*#__PURE__*/_react.default.createElement(_index.Icon, {
152
153
  type: "arrow-down"
153
154
  }));
154
155
  };
@@ -198,7 +199,8 @@ var ColorPicker = function ColorPicker(props) {
198
199
  colTypeArr: colTypeArr,
199
200
  setColTypeArr: setColTypeArr,
200
201
  currentColorType: currentColorType,
201
- setCurrentColorType: setCurrentColorType
202
+ setCurrentColorType: setCurrentColorType,
203
+ showColorPickerPanel: showColorPickerPanel
202
204
  });
203
205
  var popperProps = (0, _extends2.default)((0, _extends2.default)({}, colorPickerProps), {
204
206
  popperClassName: popUpLayer,
@@ -58,6 +58,7 @@ export interface IColorPickerPanelProps {
58
58
  showHue?: boolean;
59
59
  showOpacity?: boolean;
60
60
  };
61
+ showColorPickerPanel: boolean;
61
62
  value: string;
62
63
  setCurrentColorType: (currentColorType: IColorTypesObj['type']) => void;
63
64
  setColTypeArr: (colTypeArr: Array<IColorTypesObj>) => void;
@@ -262,7 +262,7 @@
262
262
  font-size: var(--kd-c-color-picker-panel-select-font-size, var(--kd-g-font-size-middle, 14px));
263
263
  }
264
264
  .kd-color-picker-pop .kd-color-picker-panel-input-no-recommend {
265
- margin-bottom: 8px;
265
+ margin-bottom: 0;
266
266
  }
267
267
  .kd-color-picker-pop .kd-color-picker-panel-input .kd-select.bottomLeft,
268
268
  .kd-color-picker-pop .kd-color-picker-panel-input .kd-select.topLeft {
@@ -311,6 +311,9 @@
311
311
  grid-row-gap: 8px;
312
312
  margin-top: 12px;
313
313
  }
314
+ .kd-color-picker-pop .kd-color-picker-panel-colorDivContainer-unset-color {
315
+ margin-top: 0;
316
+ }
314
317
  .kd-color-picker-pop .kd-color-picker-panel-colorDivContainer li {
315
318
  position: relative;
316
319
  -webkit-box-sizing: border-box;
@@ -209,7 +209,7 @@
209
209
  font-size: @color-picker-panel-select-font-size;
210
210
 
211
211
  &-no-recommend {
212
- margin-bottom: 8px;
212
+ margin-bottom: 0;
213
213
  }
214
214
 
215
215
  .@{kd-prefix}-select {
@@ -266,6 +266,10 @@
266
266
  grid-row-gap: 8px;
267
267
  margin-top: 12px;
268
268
 
269
+ &-unset-color {
270
+ margin-top: 0;
271
+ }
272
+
269
273
  li {
270
274
  position: relative;
271
275
  box-sizing: border-box;
@@ -28,7 +28,7 @@ var findItem = function findItem(element) {
28
28
  }
29
29
  };
30
30
  var Dropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
31
- var _a, _b, _c;
31
+ var _a, _b, _c, _d;
32
32
  var _React$useContext = React.useContext(_ConfigContext.default),
33
33
  getPrefixCls = _React$useContext.getPrefixCls,
34
34
  pkgPrefixCls = _React$useContext.prefixCls,
@@ -42,6 +42,7 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
42
42
  onItemClick = allProps.onItemClick,
43
43
  defaultVisible = allProps.defaultVisible,
44
44
  onVisibleChange = allProps.onVisibleChange,
45
+ trigger = allProps.trigger,
45
46
  customPrefixcls = allProps.prefixCls;
46
47
  // className前缀
47
48
  var prefixCls = getPrefixCls(pkgPrefixCls, 'dropdown', customPrefixcls);
@@ -52,14 +53,30 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
52
53
  React.useEffect(function () {
53
54
  setVisible(!!props.visible);
54
55
  }, [props.visible]);
55
- var child = /*#__PURE__*/React.cloneElement(React.Children.only(children), {
56
+ var handleVisibleChange = function handleVisibleChange(visible) {
57
+ props.visible === undefined && setVisible(visible);
58
+ onVisibleChange && onVisibleChange(visible);
59
+ };
60
+ var child = children && ((_a = children === null || children === void 0 ? void 0 : children.type) === null || _a === void 0 ? void 0 : _a.displayName) === 'Input' ? /*#__PURE__*/React.createElement("span", {
61
+ className: (0, _classnames.default)("".concat(prefixCls, "-trigger"), "".concat(prefixCls, "-trigger-container")),
62
+ ref: ref
63
+ }, trigger === 'focus' ? /*#__PURE__*/React.cloneElement(React.Children.only(children), {
64
+ onFocus: function onFocus(e) {
65
+ children.props.onFocus && children.props.onFocus(e);
66
+ handleVisibleChange(true);
67
+ },
68
+ onBlur: function onBlur(e) {
69
+ children.props.onBlur && children.props.onBlur(e);
70
+ handleVisibleChange(false);
71
+ }
72
+ }) : children) : /*#__PURE__*/React.cloneElement(React.Children.only(children), {
56
73
  ref: children.ref || ref,
57
74
  className: (0, _classnames.default)("".concat(prefixCls, "-trigger"), children.props.className, {
58
75
  disabled: disabled
59
76
  })
60
77
  });
61
78
  var isMenu = menu.type === _menu.Menu;
62
- var _React$useState3 = React.useState(props.selectedKey || ((_a = menu.props) === null || _a === void 0 ? void 0 : _a.defaultKey) || props.defaultKey || ''),
79
+ var _React$useState3 = React.useState(props.selectedKey || ((_b = menu.props) === null || _b === void 0 ? void 0 : _b.defaultKey) || props.defaultKey || ''),
63
80
  _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
64
81
  selectedKey = _React$useState4[0],
65
82
  setSelectedKey = _React$useState4[1];
@@ -68,7 +85,7 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
68
85
  setSelectedKey(props.selectedKey);
69
86
  }
70
87
  }, [props.selectedKey]);
71
- var menuSelectable = ((_b = menu.props) === null || _b === void 0 ? void 0 : _b.selectable) === undefined ? selectable : (_c = menu.props) === null || _c === void 0 ? void 0 : _c.selectable;
88
+ var menuSelectable = ((_c = menu.props) === null || _c === void 0 ? void 0 : _c.selectable) === undefined ? selectable : (_d = menu.props) === null || _d === void 0 ? void 0 : _d.selectable;
72
89
  var handleItemClick = function handleItemClick(e) {
73
90
  var _a;
74
91
  var item = findItem(e.target);
@@ -119,10 +136,6 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
119
136
  role: "menuitem"
120
137
  }, href === undefined || disabled ? /*#__PURE__*/React.createElement("span", null, label) : /*#__PURE__*/React.createElement("a", (0, _extends2.default)({}, alinkProps), /*#__PURE__*/React.createElement("span", null, label)));
121
138
  }));
122
- var handleVisibleChange = function handleVisibleChange(visible) {
123
- props.visible === undefined && setVisible(visible);
124
- onVisibleChange && onVisibleChange(visible);
125
- };
126
139
  var popperProps = (0, _extends2.default)((0, _extends2.default)({}, allProps), {
127
140
  visible: visible,
128
141
  prefixCls: prefixCls,
@@ -109,6 +109,9 @@
109
109
  .kd-dropdown-trigger {
110
110
  outline: none;
111
111
  }
112
+ .kd-dropdown-trigger-container {
113
+ display: inline-block;
114
+ }
112
115
  .kd-dropdown {
113
116
  -webkit-box-sizing: border-box;
114
117
  box-sizing: border-box;
@@ -9,6 +9,10 @@
9
9
 
10
10
  .@{dropdown-trigger-prefix-cls} {
11
11
  outline: none;
12
+
13
+ &-container {
14
+ display: inline-block;
15
+ }
12
16
  }
13
17
 
14
18
  .@{dropdown-prefix-cls} {
@@ -165,8 +165,9 @@ var SchemeFilter = function SchemeFilter(props) {
165
165
  };
166
166
  var handleChangeOption = function handleChangeOption(index, value) {
167
167
  var nextScheme = (0, _cloneDeep.default)(scheme);
168
+ var realValue = value.target !== undefined ? value.target.value : value;
168
169
  nextScheme.items[index] = (0, _extends2.default)((0, _extends2.default)({}, nextScheme.items[index]), {
169
- value: value
170
+ value: realValue
170
171
  });
171
172
  setScheme(nextScheme);
172
173
  };
@@ -327,7 +327,8 @@
327
327
  list-style: none;
328
328
  }
329
329
  .kd-filter .kd-filter-body-scheme-detail > li {
330
- line-height: 40px;
330
+ line-height: normal;
331
+ padding: 7px 0 5px 0;
331
332
  color: var(--kd-g-color-text-primary, #212121);
332
333
  font-size: var(--kd-g-font-size-small, 12px);
333
334
  }
@@ -117,7 +117,7 @@
117
117
  display: block;
118
118
  }
119
119
  }
120
-
120
+
121
121
  &-condition {
122
122
  display: flex;
123
123
  font-size: @font-size-small;
@@ -221,7 +221,8 @@
221
221
  &-detail {
222
222
  list-style: none;
223
223
  > li {
224
- line-height: 40px;
224
+ line-height: normal;
225
+ padding: 7px 0 5px 0;
225
226
  color: @color-text-primary;
226
227
  font-size: @font-size-small;
227
228
 
@@ -43,6 +43,7 @@ var ClearableInput = function ClearableInput(props) {
43
43
  inputCount = props.inputCount,
44
44
  count = props.count,
45
45
  status = props.status;
46
+ var fixRef = (0, _react.useRef)(null);
46
47
  var _useState = (0, _react.useState)(false),
47
48
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
48
49
  isMouseEnter = _useState2[0],
@@ -57,6 +58,11 @@ var ClearableInput = function ClearableInput(props) {
57
58
  e.stopPropagation();
58
59
  e.preventDefault();
59
60
  };
61
+ var clickHandle = function clickHandle(e) {
62
+ var _a, _b;
63
+ e.stopPropagation();
64
+ (_b = (_a = fixRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('input')) === null || _b === void 0 ? void 0 : _b.focus();
65
+ };
60
66
  var renderClearIcon = function renderClearIcon() {
61
67
  var _classNames;
62
68
  if (!allowClear) {
@@ -98,7 +104,9 @@ var ClearableInput = function ClearableInput(props) {
98
104
  var inputWrapperClasses = (0, _classnames.default)((_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper"), true), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-focused"), focused && !disabled), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context = "".concat(prefixCls, "-wrapper-size-")).call(_context, size), size), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-error"), status === 'error'), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-wrapper-disabled"), disabled), _classNames2), (0, _defineProperty2.default)({}, className, className && !addonBefore && !addonAfter));
99
105
  return /*#__PURE__*/_react.default.createElement("span", {
100
106
  className: inputWrapperClasses,
107
+ ref: fixRef,
101
108
  style: style,
109
+ onClick: clickHandle,
102
110
  onMouseEnter: mouseEnterHandle,
103
111
  onMouseLeave: mouseLeaveHandle
104
112
  }, prefixNode, /*#__PURE__*/_react.default.cloneElement(originElement, {
@@ -60,9 +60,12 @@ var InternalOption = function InternalOption(props, ref) {
60
60
  }
61
61
  onChangeSelect && onChangeSelect(value, children, isSelected);
62
62
  };
63
- var handleOnMouseMove = function handleOnMouseMove() {
63
+ var handleOnMouseEnter = function handleOnMouseEnter() {
64
64
  onChangeActiveIndex && onChangeActiveIndex(index);
65
65
  };
66
+ var handleOnMouseLeave = function handleOnMouseLeave() {
67
+ onChangeActiveIndex && onChangeActiveIndex(-1);
68
+ };
66
69
  var titleText = title || ((0, _typeof2.default)(children) !== 'object' ? children : null);
67
70
  var checkStyle = {
68
71
  minHeight: '22px',
@@ -73,7 +76,8 @@ var InternalOption = function InternalOption(props, ref) {
73
76
  className: optionCls,
74
77
  title: titleText,
75
78
  onClick: handleClick,
76
- onMouseMove: handleOnMouseMove
79
+ onMouseEnter: handleOnMouseEnter,
80
+ onMouseLeave: handleOnMouseLeave
77
81
  }, /*#__PURE__*/_react.default.createElement("div", {
78
82
  className: contentCls
79
83
  }, isMultiple ? /*#__PURE__*/_react.default.createElement(_index.Checkbox, {
@@ -65,7 +65,8 @@ var InternalSelect = function InternalSelect(props, ref) {
65
65
  children = selectProps.children,
66
66
  options = selectProps.options,
67
67
  placeholder = selectProps.placeholder,
68
- dropdownStyle = selectProps.dropdownStyle,
68
+ _selectProps$dropdown = selectProps.dropdownStyle,
69
+ dropdownStyle = _selectProps$dropdown === void 0 ? {} : _selectProps$dropdown,
69
70
  style = selectProps.style,
70
71
  clearIcon = selectProps.clearIcon,
71
72
  filterOption = selectProps.filterOption,
@@ -94,6 +95,7 @@ var InternalSelect = function InternalSelect(props, ref) {
94
95
  selectMulOpts: []
95
96
  }); // 多选ref已选中项
96
97
  var measureRef = (0, _react.useRef)(null);
98
+ var clearRef = (0, _react.useRef)(null);
97
99
  var _useState = (0, _react.useState)([]),
98
100
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
99
101
  mulOptions = _useState2[0],
@@ -134,7 +136,7 @@ var InternalSelect = function InternalSelect(props, ref) {
134
136
  // 多选底部样式
135
137
  var multipleFooterCls = (0, _classnames.default)((0, _defineProperty2.default)({}, "".concat(selectPrefixCls, "-multiple-footer"), true));
136
138
  // 多选,单选公共样式
137
- var commCls = (0, _classnames.default)((_classNames6 = {}, (0, _defineProperty2.default)(_classNames6, "".concat(selectPrefixCls, "-bordered"), borderType === 'bordered'), (0, _defineProperty2.default)(_classNames6, "".concat(selectPrefixCls, "-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames6, "".concat(selectPrefixCls, "-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames6, (0, _concat.default)(_context = "".concat(selectPrefixCls, "-size-")).call(_context, size), size), (0, _defineProperty2.default)(_classNames6, "".concat(selectPrefixCls, "-wrapper"), true), (0, _defineProperty2.default)(_classNames6, "".concat(selectPrefixCls, "-show-search"), isShowSearch), _classNames6));
139
+ var commCls = (0, _classnames.default)((_classNames6 = {}, (0, _defineProperty2.default)(_classNames6, "".concat(selectPrefixCls, "-bordered"), borderType === 'bordered'), (0, _defineProperty2.default)(_classNames6, "".concat(selectPrefixCls, "-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames6, "".concat(selectPrefixCls, "-borderless"), borderType === 'none'), (0, _defineProperty2.default)(_classNames6, (0, _concat.default)(_context = "".concat(selectPrefixCls, "-size-")).call(_context, size), size), (0, _defineProperty2.default)(_classNames6, "".concat(selectPrefixCls, "-wrapper"), true), (0, _defineProperty2.default)(_classNames6, "".concat(selectPrefixCls, "-show-search"), isShowSearch && focusd), _classNames6));
138
140
  (0, _react.useEffect)(function () {
139
141
  if (typeof props.visible !== 'undefined') {
140
142
  setOptionShow(props.visible);
@@ -280,7 +282,7 @@ var InternalSelect = function InternalSelect(props, ref) {
280
282
  }, [optionLabelProp, selectProps]);
281
283
  // 点击下拉列表中某项回调
282
284
  var handleOption = function handleOption(key, label, isSelected) {
283
- var _a;
285
+ var _a, _b;
284
286
  var onSelect = selectProps.onSelect,
285
287
  onDeselect = selectProps.onDeselect,
286
288
  labelInValue = selectProps.labelInValue,
@@ -295,6 +297,8 @@ var InternalSelect = function InternalSelect(props, ref) {
295
297
  })) || {};
296
298
  if (isMultiple) {
297
299
  (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
300
+ } else {
301
+ (_b = searchRef.current) === null || _b === void 0 ? void 0 : _b.blur();
298
302
  }
299
303
  var optionsObj = obj.props ? obj.props : obj || {};
300
304
  if (value !== undefined) {
@@ -451,17 +455,17 @@ var InternalSelect = function InternalSelect(props, ref) {
451
455
  var renderSuffix = function renderSuffix() {
452
456
  var _classNames7;
453
457
  var suffixIcon = selectProps.suffixIcon;
454
- var selectedVal = multipleRef.current.selectedVal;
455
458
  // 选择器下拉icon样式
456
459
  var arrowIconCls = (0, _classnames.default)((_classNames7 = {}, (0, _defineProperty2.default)(_classNames7, "".concat(selectPrefixCls, "-icon-arrow"), true), (0, _defineProperty2.default)(_classNames7, "".concat(selectPrefixCls, "-icon-arrow-up"), optionShow), (0, _defineProperty2.default)(_classNames7, "".concat(selectPrefixCls, "-icon-arrow-down"), !optionShow), (0, _defineProperty2.default)(_classNames7, "".concat(selectPrefixCls, "-icon-arrow-focus"), optionShow), _classNames7));
457
- var iconShow = allowClear && !disabled && ((isMultiple ? mulOptions.length > 0 : (selectedVal !== null && selectedVal !== void 0 ? selectedVal : '') !== '') || searchValue);
460
+ var iconShow = allowClear && !disabled && ((isMultiple ? mulOptions.length > 0 : (singleVal !== null && singleVal !== void 0 ? singleVal : '') !== '') || searchValue);
458
461
  var clearIconCls = (0, _classnames.default)((0, _defineProperty2.default)({}, "".concat(selectPrefixCls, "-icon-clear"), true));
459
462
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, iconShow && /*#__PURE__*/_react.default.createElement("span", {
460
463
  onClick: handleReset,
461
464
  onMouseDown: function onMouseDown(e) {
462
465
  return e.preventDefault();
463
466
  },
464
- className: clearIconCls
467
+ className: clearIconCls,
468
+ ref: clearRef
465
469
  }, clearIcon || /*#__PURE__*/_react.default.createElement(_index.Icon, {
466
470
  type: "close-solid"
467
471
  })), showArrow && /*#__PURE__*/_react.default.createElement("span", {
@@ -557,9 +561,6 @@ var InternalSelect = function InternalSelect(props, ref) {
557
561
  maxHeight: listHeight || '300px'
558
562
  };
559
563
  // 下拉框style属性
560
- var dropDownStyle = (0, _extends2.default)({
561
- width: style === null || style === void 0 ? void 0 : style.width
562
- }, dropdownStyle);
563
564
  var checkboxStyle = {
564
565
  height: '30px',
565
566
  background: 'none'
@@ -568,7 +569,7 @@ var InternalSelect = function InternalSelect(props, ref) {
568
569
  var checked = mulOptions.length === filledOptions.length;
569
570
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
570
571
  className: dropDownCls,
571
- style: dropDownStyle,
572
+ style: dropdownStyle,
572
573
  ref: dropDownRef
573
574
  }, !dropdownRender && childrenToRender.length > 0 && dropRender(eleOptionList, heightStyle), renderNotContent(), /*#__PURE__*/_react.default.createElement("div", null, dropdownRender && dropdownRender(dropRender(childrenToRender, heightStyle))), isMultiple && realChildren.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
574
575
  className: multipleFooterCls
@@ -732,7 +733,18 @@ var InternalSelect = function InternalSelect(props, ref) {
732
733
  onDropdownVisibleChange && onDropdownVisibleChange(true);
733
734
  }
734
735
  }, [optionShow]);
735
- var _useState13 = (0, _react.useState)(getActiveIndex(0)),
736
+ (0, _react.useEffect)(function () {
737
+ var _a;
738
+ var fn = function fn(e) {
739
+ e.stopPropagation();
740
+ };
741
+ (_a = clearRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseup', fn);
742
+ return function () {
743
+ var _a;
744
+ (_a = clearRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseup', fn);
745
+ };
746
+ }, [singleVal, mulOptions]);
747
+ var _useState13 = (0, _react.useState)(isShowSearch ? getActiveIndex(0) : -1),
736
748
  _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
737
749
  activeIndex = _useState14[0],
738
750
  setActiveIndex = _useState14[1];
@@ -826,13 +838,19 @@ var InternalSelect = function InternalSelect(props, ref) {
826
838
  if (selectRef === null || selectRef === void 0 ? void 0 : selectRef.current) {
827
839
  var _ref2 = (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(),
828
840
  width = _ref2.width;
829
- return (0, _extends2.default)({
830
- width: (dropdownStyle === null || dropdownStyle === void 0 ? void 0 : dropdownStyle.width) || (width > 75 ? width : 75),
841
+ return (0, _extends2.default)((0, _extends2.default)((0, _extends2.default)({
842
+ minWidth: width,
843
+ maxWidth: 600
844
+ }, dropdownStyle), {
845
+ width: (dropdownStyle === null || dropdownStyle === void 0 ? void 0 : dropdownStyle.width) || 'auto',
831
846
  zIndex: 1050
832
- }, popperStyle);
847
+ }), popperStyle);
833
848
  }
834
849
  };
835
850
  var handleVisibleChange = function handleVisibleChange(visible) {
851
+ if (!visible) {
852
+ setActiveIndex(isShowSearch ? getActiveIndex(0) : -1);
853
+ }
836
854
  if (visible !== optionShow) {
837
855
  props.visible === undefined && setOptionShow(visible);
838
856
  onVisibleChange && onVisibleChange(visible);
@@ -249,7 +249,7 @@
249
249
  .kd-select-visible .kd-select-icon-active {
250
250
  color: #3761ca;
251
251
  }
252
- .kd-select-visible .kd-select-selection-item {
252
+ .kd-select-visible div.kd-select-show-search .kd-select-selection-item {
253
253
  color: var(--kd-c-select-placeholder-color-text, #b2b2b2);
254
254
  }
255
255
  .kd-select-icon-arrow {
@@ -277,9 +277,6 @@
277
277
  transition: transform calc(0.3s - 0.1s) cubic-bezier(0.4, 0, 0.6, 1);
278
278
  transition: transform calc(0.3s - 0.1s) cubic-bezier(0.4, 0, 0.6, 1), -webkit-transform calc(0.3s - 0.1s) cubic-bezier(0.4, 0, 0.6, 1);
279
279
  }
280
- .kd-select-icon-arrow-focus {
281
- color: var(--kd-c-select-color-border-foucs, var(--kd-g-color-theme, #5582f3));
282
- }
283
280
  .kd-select-icon-clear {
284
281
  opacity: 0;
285
282
  z-index: 1;
@@ -362,7 +359,7 @@
362
359
  z-index: var(--kd-c-select-z-index, var(--kd-g-z-index-popper, 1050));
363
360
  -webkit-box-sizing: border-box;
364
361
  box-sizing: border-box;
365
- padding: 4px 0;
362
+ padding: 8px 0;
366
363
  margin: 0;
367
364
  overflow: auto;
368
365
  font-size: var(--kd-c-select-dropdown-font-size, 12px);
@@ -415,9 +412,6 @@
415
412
  .kd-select-item-option-content .kd-checkbox .kd-checkbox-children {
416
413
  display: inline-block;
417
414
  }
418
- .kd-select-item-option:hover:not(.kd-select-item-option-selected):not(.kd-select-item-option-disabled) {
419
- background-color: var(--kd-c-select-color-background, #f5f5f5);
420
- }
421
415
  .kd-select-item-option-active:not(.kd-select-item-option-disabled) {
422
416
  background-color: var(--kd-c-select-color-background, #f5f5f5);
423
417
  }
@@ -21,7 +21,8 @@
21
21
  .@{select-prefix-cls}-icon-active {
22
22
  color: #3761ca;
23
23
  }
24
- .@{select-prefix-cls}-selection-item {
24
+
25
+ & div.@{select-prefix-cls}-show-search .@{select-prefix-cls}-selection-item {
25
26
  color: @select-placeholder-color;
26
27
  }
27
28
  }
@@ -40,10 +41,6 @@
40
41
  transform: rotate(0deg);
41
42
  transition: transform calc(@transition-duration - 0.1s) @ease;
42
43
  }
43
-
44
- &-focus {
45
- color: @select-g-color-border-foucs;
46
- }
47
44
  }
48
45
 
49
46
  &-clear {
@@ -135,7 +132,7 @@
135
132
  left: 0;
136
133
  z-index: @select-z-index;
137
134
  box-sizing: border-box;
138
- padding: 4px 0; // update
135
+ padding: 8px 0; // update
139
136
  margin: 0;
140
137
  overflow: auto;
141
138
  font-size: @select-list-font-size; // update
@@ -184,10 +181,6 @@
184
181
  }
185
182
  }
186
183
 
187
- &:hover:not(&-selected):not(&-disabled) {
188
- background-color: @select-item-active-bg;
189
- }
190
-
191
184
  &-active:not(&-disabled) {
192
185
  background-color: @select-item-active-bg;
193
186
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/kdesign",
3
- "version": "1.7.16",
3
+ "version": "1.7.18",
4
4
  "description": "KDesign 金蝶前端react 组件库",
5
5
  "title": "kdesign",
6
6
  "keywords": [