@kdcloudjs/kdesign 1.7.17 → 1.7.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/kdesign-complete.less +54 -21
- package/dist/kdesign.css +23 -15
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +329 -248
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +3 -3
- package/dist/kdesign.min.js +6 -6
- package/dist/kdesign.min.js.map +1 -1
- package/es/carousel/style/index.css +4 -0
- package/es/carousel/style/index.less +31 -5
- package/es/cascader/cascader.js +63 -62
- package/es/cascader/style/index.css +16 -6
- package/es/cascader/style/index.less +20 -6
- package/es/collapse/collapse.d.ts +1 -1
- package/es/dropdown/dropdown.d.ts +1 -0
- package/es/dropdown/dropdown.js +22 -7
- package/es/input/ClearableLabeledInput.js +9 -1
- package/es/select/option.js +6 -2
- package/es/select/select.js +32 -14
- package/es/select/style/index.css +2 -8
- package/es/select/style/index.less +3 -10
- package/es/upload/upload.js +87 -63
- package/lib/carousel/style/index.css +4 -0
- package/lib/carousel/style/index.less +31 -5
- package/lib/cascader/cascader.js +62 -61
- package/lib/cascader/style/index.css +16 -6
- package/lib/cascader/style/index.less +20 -6
- package/lib/collapse/collapse.d.ts +1 -1
- package/lib/dropdown/dropdown.d.ts +1 -0
- package/lib/dropdown/dropdown.js +22 -7
- package/lib/input/ClearableLabeledInput.js +8 -0
- package/lib/select/option.js +6 -2
- package/lib/select/select.js +32 -14
- package/lib/select/style/index.css +2 -8
- package/lib/select/style/index.less +3 -10
- package/lib/upload/upload.js +86 -62
- package/package.json +1 -1
package/lib/cascader/cascader.js
CHANGED
|
@@ -72,38 +72,41 @@ var Cascader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
72
72
|
onPopupVisibleChange = allProps.onPopupVisibleChange,
|
|
73
73
|
onPopperVisibleChange = allProps.onPopperVisibleChange,
|
|
74
74
|
customPrefixcls = allProps.prefixCls,
|
|
75
|
+
customAllowClear = allProps.allowClear,
|
|
76
|
+
popupPlacement = allProps.popupPlacement,
|
|
77
|
+
maxTagCount = allProps.maxTagCount,
|
|
75
78
|
otherProps = __rest(allProps
|
|
76
79
|
// className前缀
|
|
77
|
-
, ["mode", "style", "options", "bordered", "disabled", "children", "loadData", "clearIcon", "className", "fieldNames", "placeholder", "defaultValue", "maxTagPlaceholder", "displayRender", "expandTrigger", "changeOnSelect", "dropdownRender", "notFoundContent", "getPopupContainer", "defaultPopupVisible", "onPopupVisibleChange", "onPopperVisibleChange", "prefixCls"]);
|
|
80
|
+
, ["mode", "style", "options", "bordered", "disabled", "children", "loadData", "clearIcon", "className", "fieldNames", "placeholder", "defaultValue", "maxTagPlaceholder", "displayRender", "expandTrigger", "changeOnSelect", "dropdownRender", "notFoundContent", "getPopupContainer", "defaultPopupVisible", "onPopupVisibleChange", "onPopperVisibleChange", "prefixCls", "allowClear", "popupPlacement", "maxTagCount"]);
|
|
78
81
|
// className前缀
|
|
79
82
|
var prefixCls = getPrefixCls(pkgPrefixCls, 'cascader', customPrefixcls);
|
|
80
|
-
var pickerRef = _react.
|
|
81
|
-
var triggerRef = _react.
|
|
82
|
-
var wrapperRef = _react.
|
|
83
|
+
var pickerRef = (0, _react.useRef)();
|
|
84
|
+
var triggerRef = (0, _react.useRef)();
|
|
85
|
+
var wrapperRef = (0, _react.useRef)();
|
|
83
86
|
var mergeRef = ref || pickerRef;
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
visible =
|
|
87
|
-
setVisible =
|
|
87
|
+
var _useState = (0, _react.useState)(!!props.popperVisible || !!props.popupVisible || defaultPopupVisible),
|
|
88
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
89
|
+
visible = _useState2[0],
|
|
90
|
+
setVisible = _useState2[1];
|
|
88
91
|
_react.default.useEffect(function () {
|
|
89
92
|
setVisible(!!props.popperVisible || !!props.popupVisible);
|
|
90
93
|
}, [props.popperVisible, props.popupVisible]);
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
menus =
|
|
94
|
-
setMenus =
|
|
95
|
-
var
|
|
96
|
-
|
|
97
|
-
currentOptions =
|
|
98
|
-
setCurrentOptions =
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
selectedOptions =
|
|
102
|
-
setSelectedOptions =
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
value =
|
|
106
|
-
setValue =
|
|
94
|
+
var _useState3 = (0, _react.useState)([options]),
|
|
95
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
96
|
+
menus = _useState4[0],
|
|
97
|
+
setMenus = _useState4[1];
|
|
98
|
+
var _useState5 = (0, _react.useState)([]),
|
|
99
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
100
|
+
currentOptions = _useState6[0],
|
|
101
|
+
setCurrentOptions = _useState6[1];
|
|
102
|
+
var _useState7 = (0, _react.useState)([]),
|
|
103
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
104
|
+
selectedOptions = _useState8[0],
|
|
105
|
+
setSelectedOptions = _useState8[1];
|
|
106
|
+
var _useState9 = (0, _react.useState)(props.value || defaultValue || []),
|
|
107
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
108
|
+
value = _useState10[0],
|
|
109
|
+
setValue = _useState10[1];
|
|
107
110
|
_react.default.useEffect(function () {
|
|
108
111
|
props.value && setValue(props.value);
|
|
109
112
|
}, [props.value]);
|
|
@@ -205,37 +208,10 @@ var Cascader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
205
208
|
});
|
|
206
209
|
});
|
|
207
210
|
}, [currentOptions, isMultiple]);
|
|
208
|
-
var allowClear =
|
|
209
|
-
var locatorProps = {
|
|
210
|
-
style: style,
|
|
211
|
-
tabIndex: 0,
|
|
212
|
-
className: (0, _classnames.default)("".concat(prefixCls, "-picker"), className, {
|
|
213
|
-
expand: visible,
|
|
214
|
-
allowClear: allowClear,
|
|
215
|
-
disabled: disabled
|
|
216
|
-
})
|
|
217
|
-
};
|
|
211
|
+
var allowClear = customAllowClear && value.length > 0;
|
|
218
212
|
var handleClear = function handleClear() {
|
|
219
213
|
onChange([]);
|
|
220
214
|
};
|
|
221
|
-
var inputProps = {
|
|
222
|
-
value: value,
|
|
223
|
-
placeholder: placeholder,
|
|
224
|
-
readOnly: true,
|
|
225
|
-
disabled: disabled,
|
|
226
|
-
className: (0, _classnames.default)("".concat(prefixCls, "-picker-input"), {
|
|
227
|
-
expand: visible
|
|
228
|
-
}),
|
|
229
|
-
suffix: props.suffixIcon || /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
230
|
-
type: "arrow-down",
|
|
231
|
-
className: (0, _classnames.default)({
|
|
232
|
-
expand: visible
|
|
233
|
-
})
|
|
234
|
-
})
|
|
235
|
-
};
|
|
236
|
-
if (bordered) {
|
|
237
|
-
inputProps.borderType = 'bordered';
|
|
238
|
-
}
|
|
239
215
|
var renderSuffix = function renderSuffix() {
|
|
240
216
|
var _classNames;
|
|
241
217
|
var suffixIcon = allProps.suffixIcon;
|
|
@@ -273,8 +249,6 @@ var Cascader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
273
249
|
};
|
|
274
250
|
var renderMultiple = function renderMultiple() {
|
|
275
251
|
var _classNames3, _classNames4;
|
|
276
|
-
var maxTagCount = allProps.maxTagCount,
|
|
277
|
-
maxTagPlaceholder = allProps.maxTagPlaceholder;
|
|
278
252
|
var multipleCls = (0, _classnames.default)((_classNames3 = {
|
|
279
253
|
disabled: disabled
|
|
280
254
|
}, (0, _defineProperty2.default)(_classNames3, "".concat(prefixCls, "-multiple"), true), (0, _defineProperty2.default)(_classNames3, "".concat(prefixCls, "-bordered"), bordered), _classNames3));
|
|
@@ -313,19 +287,44 @@ var Cascader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
313
287
|
}, renderSuffix())));
|
|
314
288
|
};
|
|
315
289
|
var renderSingle = function renderSingle() {
|
|
316
|
-
|
|
290
|
+
var inputProps = {
|
|
291
|
+
value: value,
|
|
292
|
+
placeholder: placeholder,
|
|
293
|
+
readOnly: true,
|
|
294
|
+
borderType: bordered ? 'bordered' : 'underline',
|
|
295
|
+
disabled: disabled,
|
|
296
|
+
className: (0, _classnames.default)("".concat(prefixCls, "-picker-input"), {
|
|
297
|
+
expand: visible
|
|
298
|
+
}),
|
|
299
|
+
suffix: props.suffixIcon || /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
300
|
+
type: "arrow-down",
|
|
301
|
+
className: (0, _classnames.default)({
|
|
302
|
+
expand: visible
|
|
303
|
+
})
|
|
304
|
+
})
|
|
305
|
+
};
|
|
306
|
+
var singleProps = {
|
|
307
|
+
style: style,
|
|
308
|
+
tabIndex: 0,
|
|
309
|
+
className: (0, _classnames.default)("".concat(prefixCls, "-picker"), className, (0, _defineProperty2.default)({
|
|
310
|
+
expand: visible,
|
|
311
|
+
allowClear: allowClear,
|
|
312
|
+
disabled: disabled
|
|
313
|
+
}, "".concat(prefixCls, "-bordered"), bordered))
|
|
314
|
+
};
|
|
315
|
+
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, singleProps, {
|
|
317
316
|
ref: mergeRef
|
|
318
317
|
}, otherProps), _react.default.Children.count(children) === 1 && children.type ? /*#__PURE__*/_react.default.cloneElement(children, {
|
|
319
318
|
ref: triggerRef
|
|
320
|
-
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("
|
|
319
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
321
320
|
ref: triggerRef
|
|
322
321
|
}, /*#__PURE__*/_react.default.createElement(_input.default, (0, _extends2.default)({}, inputProps)), /*#__PURE__*/_react.default.createElement("span", {
|
|
323
322
|
className: "".concat(prefixCls, "-picker-label")
|
|
324
|
-
}, (labels === null || labels === void 0 ? void 0 : labels.length) ? displayRender(labels, currentOptions) : '')
|
|
323
|
+
}, (labels === null || labels === void 0 ? void 0 : labels.length) ? displayRender(labels, currentOptions) : ''), allowClear && /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
325
324
|
type: "close-solid",
|
|
326
325
|
className: "".concat(prefixCls, "-picker-close"),
|
|
327
326
|
onClick: handleClear
|
|
328
|
-
})));
|
|
327
|
+
}))));
|
|
329
328
|
};
|
|
330
329
|
var cascaderLocator = isMultiple ? renderMultiple() : renderSingle();
|
|
331
330
|
var onExpend = function onExpend(index, opt, opts) {
|
|
@@ -371,8 +370,10 @@ var Cascader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
371
370
|
var value = _ref5[fieldNames.value];
|
|
372
371
|
return value;
|
|
373
372
|
});
|
|
374
|
-
|
|
375
|
-
|
|
373
|
+
if (typeof props.value === 'undefined') {
|
|
374
|
+
setCurrentOptions(selectedOptions);
|
|
375
|
+
setValue(selectedValue);
|
|
376
|
+
}
|
|
376
377
|
props.onChange && props.onChange(selectedValue, selectedOptions);
|
|
377
378
|
};
|
|
378
379
|
var onVisibleChange = function onVisibleChange(visible) {
|
|
@@ -437,7 +438,7 @@ var Cascader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
437
438
|
trigger: 'click',
|
|
438
439
|
getPopupContainer: getPopupContainer,
|
|
439
440
|
prefixCls: "".concat(prefixCls, "-menus"),
|
|
440
|
-
placement: allProps.popperPlacement ||
|
|
441
|
+
placement: allProps.popperPlacement || popupPlacement,
|
|
441
442
|
popperClassName: allProps.popperClassName || allProps.popupClassName,
|
|
442
443
|
getTriggerElement: function getTriggerElement() {
|
|
443
444
|
return triggerRef.current;
|
|
@@ -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
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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
|
-
|
|
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:
|
|
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
|
|
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 {
|
|
@@ -11,7 +11,7 @@ export interface CollapseProps {
|
|
|
11
11
|
defaultActiveKey?: string[] | string | number[] | number;
|
|
12
12
|
expandIcon?: React.ReactNode | ((props: PanelProps) => React.ReactNode);
|
|
13
13
|
expandIconPosition?: IconPositionType;
|
|
14
|
-
onChange?: () => void;
|
|
14
|
+
onChange?: (v: any) => void;
|
|
15
15
|
style?: React.CSSProperties;
|
|
16
16
|
className?: string;
|
|
17
17
|
children?: React.ReactNode;
|
|
@@ -19,6 +19,7 @@ export interface DropDownProps extends PopperProps {
|
|
|
19
19
|
children?: React.ReactNode;
|
|
20
20
|
onItemClick?: (key: string) => void;
|
|
21
21
|
menu: React.ReactElement | Array<MenuItem>;
|
|
22
|
+
menuAnimation?: boolean;
|
|
22
23
|
}
|
|
23
24
|
interface DropdownType extends React.ForwardRefExoticComponent<DropDownProps & React.RefAttributes<HTMLElement>> {
|
|
24
25
|
Menu: typeof Menu;
|
package/lib/dropdown/dropdown.js
CHANGED
|
@@ -42,9 +42,12 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
42
42
|
onItemClick = allProps.onItemClick,
|
|
43
43
|
defaultVisible = allProps.defaultVisible,
|
|
44
44
|
onVisibleChange = allProps.onVisibleChange,
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
trigger = allProps.trigger,
|
|
46
|
+
customPrefixcls = allProps.prefixCls,
|
|
47
|
+
menuAnimation = allProps.menuAnimation,
|
|
48
|
+
popperStyle = allProps.popperStyle;
|
|
47
49
|
var prefixCls = getPrefixCls(pkgPrefixCls, 'dropdown', customPrefixcls);
|
|
50
|
+
var innerAnimation = typeof menuAnimation === 'boolean' ? menuAnimation : trigger !== 'contextMenu';
|
|
48
51
|
var _React$useState = React.useState(!!props.visible || defaultVisible),
|
|
49
52
|
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
50
53
|
visible = _React$useState2[0],
|
|
@@ -52,10 +55,23 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
52
55
|
React.useEffect(function () {
|
|
53
56
|
setVisible(!!props.visible);
|
|
54
57
|
}, [props.visible]);
|
|
58
|
+
var handleVisibleChange = function handleVisibleChange(visible) {
|
|
59
|
+
props.visible === undefined && setVisible(visible);
|
|
60
|
+
onVisibleChange && onVisibleChange(visible);
|
|
61
|
+
};
|
|
55
62
|
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", {
|
|
56
63
|
className: (0, _classnames.default)("".concat(prefixCls, "-trigger"), "".concat(prefixCls, "-trigger-container")),
|
|
57
64
|
ref: ref
|
|
58
|
-
},
|
|
65
|
+
}, trigger === 'focus' ? /*#__PURE__*/React.cloneElement(React.Children.only(children), {
|
|
66
|
+
onFocus: function onFocus(e) {
|
|
67
|
+
children.props.onFocus && children.props.onFocus(e);
|
|
68
|
+
handleVisibleChange(true);
|
|
69
|
+
},
|
|
70
|
+
onBlur: function onBlur(e) {
|
|
71
|
+
children.props.onBlur && children.props.onBlur(e);
|
|
72
|
+
handleVisibleChange(false);
|
|
73
|
+
}
|
|
74
|
+
}) : children) : /*#__PURE__*/React.cloneElement(React.Children.only(children), {
|
|
59
75
|
ref: children.ref || ref,
|
|
60
76
|
className: (0, _classnames.default)("".concat(prefixCls, "-trigger"), children.props.className, {
|
|
61
77
|
disabled: disabled
|
|
@@ -122,13 +138,12 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
122
138
|
role: "menuitem"
|
|
123
139
|
}, href === undefined || disabled ? /*#__PURE__*/React.createElement("span", null, label) : /*#__PURE__*/React.createElement("a", (0, _extends2.default)({}, alinkProps), /*#__PURE__*/React.createElement("span", null, label)));
|
|
124
140
|
}));
|
|
125
|
-
var handleVisibleChange = function handleVisibleChange(visible) {
|
|
126
|
-
props.visible === undefined && setVisible(visible);
|
|
127
|
-
onVisibleChange && onVisibleChange(visible);
|
|
128
|
-
};
|
|
129
141
|
var popperProps = (0, _extends2.default)((0, _extends2.default)({}, allProps), {
|
|
130
142
|
visible: visible,
|
|
131
143
|
prefixCls: prefixCls,
|
|
144
|
+
popperStyle: innerAnimation ? popperStyle : (0, _extends2.default)({
|
|
145
|
+
animation: 'none'
|
|
146
|
+
}, popperStyle),
|
|
132
147
|
onVisibleChange: handleVisibleChange
|
|
133
148
|
});
|
|
134
149
|
return (0, _usePopper.default)(child, menuElement, popperProps);
|
|
@@ -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, {
|
package/lib/select/option.js
CHANGED
|
@@ -60,9 +60,12 @@ var InternalOption = function InternalOption(props, ref) {
|
|
|
60
60
|
}
|
|
61
61
|
onChangeSelect && onChangeSelect(value, children, isSelected);
|
|
62
62
|
};
|
|
63
|
-
var
|
|
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
|
-
|
|
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, {
|
package/lib/select/select.js
CHANGED
|
@@ -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
|
-
|
|
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 : (
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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:
|
|
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
|
}
|