@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.
- package/CHANGELOG.md +28 -0
- package/dist/kdesign-complete.less +35 -19
- package/dist/kdesign.css +28 -17
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +198 -135
- 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/card/card.js +27 -17
- package/es/carousel/carousel.js +3 -2
- package/es/carousel/slideList.d.ts +1 -0
- package/es/carousel/slideList.js +5 -2
- package/es/cascader/cascader.js +59 -60
- package/es/cascader/style/index.css +16 -6
- package/es/cascader/style/index.less +20 -6
- package/es/color-picker/color-picker-panel.js +4 -3
- package/es/color-picker/color-picker.js +4 -2
- package/es/color-picker/interface.d.ts +1 -0
- package/es/color-picker/style/index.css +4 -1
- package/es/color-picker/style/index.less +5 -1
- package/es/dropdown/dropdown.js +21 -8
- package/es/dropdown/style/index.css +3 -0
- package/es/dropdown/style/index.less +4 -0
- package/es/filter/scheme.js +2 -1
- package/es/filter/style/index.css +2 -1
- package/es/filter/style/index.less +3 -2
- 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/lib/card/card.js +27 -17
- package/lib/carousel/carousel.js +3 -2
- package/lib/carousel/slideList.d.ts +1 -0
- package/lib/carousel/slideList.js +5 -2
- package/lib/cascader/cascader.js +58 -59
- package/lib/cascader/style/index.css +16 -6
- package/lib/cascader/style/index.less +20 -6
- package/lib/color-picker/color-picker-panel.js +4 -3
- package/lib/color-picker/color-picker.js +4 -2
- package/lib/color-picker/interface.d.ts +1 -0
- package/lib/color-picker/style/index.css +4 -1
- package/lib/color-picker/style/index.less +5 -1
- package/lib/dropdown/dropdown.js +21 -8
- package/lib/dropdown/style/index.css +3 -0
- package/lib/dropdown/style/index.less +4 -0
- package/lib/filter/scheme.js +2 -1
- package/lib/filter/style/index.css +2 -1
- package/lib/filter/style/index.less +3 -2
- 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/package.json +1 -1
|
@@ -327,7 +327,8 @@
|
|
|
327
327
|
list-style: none;
|
|
328
328
|
}
|
|
329
329
|
.kd-filter .kd-filter-body-scheme-detail > li {
|
|
330
|
-
line-height:
|
|
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:
|
|
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
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
3
3
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
4
|
-
import React, { useState } from 'react';
|
|
4
|
+
import React, { useRef, useState } from 'react';
|
|
5
5
|
import { Icon } from '../index';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { tuple } from '../_utils/type';
|
|
@@ -30,6 +30,7 @@ var ClearableInput = function ClearableInput(props) {
|
|
|
30
30
|
inputCount = props.inputCount,
|
|
31
31
|
count = props.count,
|
|
32
32
|
status = props.status;
|
|
33
|
+
var fixRef = useRef(null);
|
|
33
34
|
var _useState = useState(false),
|
|
34
35
|
_useState2 = _slicedToArray(_useState, 2),
|
|
35
36
|
isMouseEnter = _useState2[0],
|
|
@@ -44,6 +45,11 @@ var ClearableInput = function ClearableInput(props) {
|
|
|
44
45
|
e.stopPropagation();
|
|
45
46
|
e.preventDefault();
|
|
46
47
|
};
|
|
48
|
+
var clickHandle = function clickHandle(e) {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
(_b = (_a = fixRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('input')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
52
|
+
};
|
|
47
53
|
var renderClearIcon = function renderClearIcon() {
|
|
48
54
|
var _classNames;
|
|
49
55
|
if (!allowClear) {
|
|
@@ -85,7 +91,9 @@ var ClearableInput = function ClearableInput(props) {
|
|
|
85
91
|
var inputWrapperClasses = classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper"), true), _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper-focused"), focused && !disabled), _defineProperty(_classNames2, _concatInstanceProperty(_context = "".concat(prefixCls, "-wrapper-size-")).call(_context, size), size), _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper-borderless"), borderType === 'none'), _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper-underline"), borderType === 'underline'), _defineProperty(_classNames2, "".concat(prefixCls, "-error"), status === 'error'), _defineProperty(_classNames2, "".concat(prefixCls, "-wrapper-disabled"), disabled), _classNames2), _defineProperty({}, className, className && !addonBefore && !addonAfter));
|
|
86
92
|
return /*#__PURE__*/React.createElement("span", {
|
|
87
93
|
className: inputWrapperClasses,
|
|
94
|
+
ref: fixRef,
|
|
88
95
|
style: style,
|
|
96
|
+
onClick: clickHandle,
|
|
89
97
|
onMouseEnter: mouseEnterHandle,
|
|
90
98
|
onMouseLeave: mouseLeaveHandle
|
|
91
99
|
}, prefixNode, /*#__PURE__*/React.cloneElement(originElement, {
|
package/es/select/option.js
CHANGED
|
@@ -48,9 +48,12 @@ var InternalOption = function InternalOption(props, ref) {
|
|
|
48
48
|
}
|
|
49
49
|
onChangeSelect && onChangeSelect(value, children, isSelected);
|
|
50
50
|
};
|
|
51
|
-
var
|
|
51
|
+
var handleOnMouseEnter = function handleOnMouseEnter() {
|
|
52
52
|
onChangeActiveIndex && onChangeActiveIndex(index);
|
|
53
53
|
};
|
|
54
|
+
var handleOnMouseLeave = function handleOnMouseLeave() {
|
|
55
|
+
onChangeActiveIndex && onChangeActiveIndex(-1);
|
|
56
|
+
};
|
|
54
57
|
var titleText = title || (_typeof(children) !== 'object' ? children : null);
|
|
55
58
|
var checkStyle = {
|
|
56
59
|
minHeight: '22px',
|
|
@@ -61,7 +64,8 @@ var InternalOption = function InternalOption(props, ref) {
|
|
|
61
64
|
className: optionCls,
|
|
62
65
|
title: titleText,
|
|
63
66
|
onClick: handleClick,
|
|
64
|
-
|
|
67
|
+
onMouseEnter: handleOnMouseEnter,
|
|
68
|
+
onMouseLeave: handleOnMouseLeave
|
|
65
69
|
}, /*#__PURE__*/React.createElement("div", {
|
|
66
70
|
className: contentCls
|
|
67
71
|
}, isMultiple ? /*#__PURE__*/React.createElement(Checkbox, {
|
package/es/select/select.js
CHANGED
|
@@ -53,7 +53,8 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
53
53
|
children = selectProps.children,
|
|
54
54
|
options = selectProps.options,
|
|
55
55
|
placeholder = selectProps.placeholder,
|
|
56
|
-
|
|
56
|
+
_selectProps$dropdown = selectProps.dropdownStyle,
|
|
57
|
+
dropdownStyle = _selectProps$dropdown === void 0 ? {} : _selectProps$dropdown,
|
|
57
58
|
style = selectProps.style,
|
|
58
59
|
clearIcon = selectProps.clearIcon,
|
|
59
60
|
filterOption = selectProps.filterOption,
|
|
@@ -82,6 +83,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
82
83
|
selectMulOpts: []
|
|
83
84
|
}); // 多选ref已选中项
|
|
84
85
|
var measureRef = useRef(null);
|
|
86
|
+
var clearRef = useRef(null);
|
|
85
87
|
var _useState = useState([]),
|
|
86
88
|
_useState2 = _slicedToArray(_useState, 2),
|
|
87
89
|
mulOptions = _useState2[0],
|
|
@@ -122,7 +124,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
122
124
|
// 多选底部样式
|
|
123
125
|
var multipleFooterCls = classNames(_defineProperty({}, "".concat(selectPrefixCls, "-multiple-footer"), true));
|
|
124
126
|
// 多选,单选公共样式
|
|
125
|
-
var commCls = classNames((_classNames6 = {}, _defineProperty(_classNames6, "".concat(selectPrefixCls, "-bordered"), borderType === 'bordered'), _defineProperty(_classNames6, "".concat(selectPrefixCls, "-underline"), borderType === 'underline'), _defineProperty(_classNames6, "".concat(selectPrefixCls, "-borderless"), borderType === 'none'), _defineProperty(_classNames6, _concatInstanceProperty(_context = "".concat(selectPrefixCls, "-size-")).call(_context, size), size), _defineProperty(_classNames6, "".concat(selectPrefixCls, "-wrapper"), true), _defineProperty(_classNames6, "".concat(selectPrefixCls, "-show-search"), isShowSearch), _classNames6));
|
|
127
|
+
var commCls = classNames((_classNames6 = {}, _defineProperty(_classNames6, "".concat(selectPrefixCls, "-bordered"), borderType === 'bordered'), _defineProperty(_classNames6, "".concat(selectPrefixCls, "-underline"), borderType === 'underline'), _defineProperty(_classNames6, "".concat(selectPrefixCls, "-borderless"), borderType === 'none'), _defineProperty(_classNames6, _concatInstanceProperty(_context = "".concat(selectPrefixCls, "-size-")).call(_context, size), size), _defineProperty(_classNames6, "".concat(selectPrefixCls, "-wrapper"), true), _defineProperty(_classNames6, "".concat(selectPrefixCls, "-show-search"), isShowSearch && focusd), _classNames6));
|
|
126
128
|
useEffect(function () {
|
|
127
129
|
if (typeof props.visible !== 'undefined') {
|
|
128
130
|
setOptionShow(props.visible);
|
|
@@ -268,7 +270,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
268
270
|
}, [optionLabelProp, selectProps]);
|
|
269
271
|
// 点击下拉列表中某项回调
|
|
270
272
|
var handleOption = function handleOption(key, label, isSelected) {
|
|
271
|
-
var _a;
|
|
273
|
+
var _a, _b;
|
|
272
274
|
var onSelect = selectProps.onSelect,
|
|
273
275
|
onDeselect = selectProps.onDeselect,
|
|
274
276
|
labelInValue = selectProps.labelInValue,
|
|
@@ -283,6 +285,8 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
283
285
|
})) || {};
|
|
284
286
|
if (isMultiple) {
|
|
285
287
|
(_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
288
|
+
} else {
|
|
289
|
+
(_b = searchRef.current) === null || _b === void 0 ? void 0 : _b.blur();
|
|
286
290
|
}
|
|
287
291
|
var optionsObj = obj.props ? obj.props : obj || {};
|
|
288
292
|
if (value !== undefined) {
|
|
@@ -439,17 +443,17 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
439
443
|
var renderSuffix = function renderSuffix() {
|
|
440
444
|
var _classNames7;
|
|
441
445
|
var suffixIcon = selectProps.suffixIcon;
|
|
442
|
-
var selectedVal = multipleRef.current.selectedVal;
|
|
443
446
|
// 选择器下拉icon样式
|
|
444
447
|
var arrowIconCls = classNames((_classNames7 = {}, _defineProperty(_classNames7, "".concat(selectPrefixCls, "-icon-arrow"), true), _defineProperty(_classNames7, "".concat(selectPrefixCls, "-icon-arrow-up"), optionShow), _defineProperty(_classNames7, "".concat(selectPrefixCls, "-icon-arrow-down"), !optionShow), _defineProperty(_classNames7, "".concat(selectPrefixCls, "-icon-arrow-focus"), optionShow), _classNames7));
|
|
445
|
-
var iconShow = allowClear && !disabled && ((isMultiple ? mulOptions.length > 0 : (
|
|
448
|
+
var iconShow = allowClear && !disabled && ((isMultiple ? mulOptions.length > 0 : (singleVal !== null && singleVal !== void 0 ? singleVal : '') !== '') || searchValue);
|
|
446
449
|
var clearIconCls = classNames(_defineProperty({}, "".concat(selectPrefixCls, "-icon-clear"), true));
|
|
447
450
|
return /*#__PURE__*/React.createElement(React.Fragment, null, iconShow && /*#__PURE__*/React.createElement("span", {
|
|
448
451
|
onClick: handleReset,
|
|
449
452
|
onMouseDown: function onMouseDown(e) {
|
|
450
453
|
return e.preventDefault();
|
|
451
454
|
},
|
|
452
|
-
className: clearIconCls
|
|
455
|
+
className: clearIconCls,
|
|
456
|
+
ref: clearRef
|
|
453
457
|
}, clearIcon || /*#__PURE__*/React.createElement(Icon, {
|
|
454
458
|
type: "close-solid"
|
|
455
459
|
})), showArrow && /*#__PURE__*/React.createElement("span", {
|
|
@@ -545,9 +549,6 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
545
549
|
maxHeight: listHeight || '300px'
|
|
546
550
|
};
|
|
547
551
|
// 下拉框style属性
|
|
548
|
-
var dropDownStyle = _extends({
|
|
549
|
-
width: style === null || style === void 0 ? void 0 : style.width
|
|
550
|
-
}, dropdownStyle);
|
|
551
552
|
var checkboxStyle = {
|
|
552
553
|
height: '30px',
|
|
553
554
|
background: 'none'
|
|
@@ -556,7 +557,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
556
557
|
var checked = mulOptions.length === filledOptions.length;
|
|
557
558
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
558
559
|
className: dropDownCls,
|
|
559
|
-
style:
|
|
560
|
+
style: dropdownStyle,
|
|
560
561
|
ref: dropDownRef
|
|
561
562
|
}, !dropdownRender && childrenToRender.length > 0 && dropRender(eleOptionList, heightStyle), renderNotContent(), /*#__PURE__*/React.createElement("div", null, dropdownRender && dropdownRender(dropRender(childrenToRender, heightStyle))), isMultiple && realChildren.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
562
563
|
className: multipleFooterCls
|
|
@@ -720,7 +721,18 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
720
721
|
onDropdownVisibleChange && onDropdownVisibleChange(true);
|
|
721
722
|
}
|
|
722
723
|
}, [optionShow]);
|
|
723
|
-
|
|
724
|
+
useEffect(function () {
|
|
725
|
+
var _a;
|
|
726
|
+
var fn = function fn(e) {
|
|
727
|
+
e.stopPropagation();
|
|
728
|
+
};
|
|
729
|
+
(_a = clearRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseup', fn);
|
|
730
|
+
return function () {
|
|
731
|
+
var _a;
|
|
732
|
+
(_a = clearRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseup', fn);
|
|
733
|
+
};
|
|
734
|
+
}, [singleVal, mulOptions]);
|
|
735
|
+
var _useState13 = useState(isShowSearch ? getActiveIndex(0) : -1),
|
|
724
736
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
725
737
|
activeIndex = _useState14[0],
|
|
726
738
|
setActiveIndex = _useState14[1];
|
|
@@ -814,13 +826,19 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
814
826
|
if (selectRef === null || selectRef === void 0 ? void 0 : selectRef.current) {
|
|
815
827
|
var _ref2 = (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(),
|
|
816
828
|
width = _ref2.width;
|
|
817
|
-
return _extends({
|
|
818
|
-
|
|
829
|
+
return _extends(_extends(_extends({
|
|
830
|
+
minWidth: width,
|
|
831
|
+
maxWidth: 600
|
|
832
|
+
}, dropdownStyle), {
|
|
833
|
+
width: (dropdownStyle === null || dropdownStyle === void 0 ? void 0 : dropdownStyle.width) || 'auto',
|
|
819
834
|
zIndex: 1050
|
|
820
|
-
}, popperStyle);
|
|
835
|
+
}), popperStyle);
|
|
821
836
|
}
|
|
822
837
|
};
|
|
823
838
|
var handleVisibleChange = function handleVisibleChange(visible) {
|
|
839
|
+
if (!visible) {
|
|
840
|
+
setActiveIndex(isShowSearch ? getActiveIndex(0) : -1);
|
|
841
|
+
}
|
|
824
842
|
if (visible !== optionShow) {
|
|
825
843
|
props.visible === undefined && setOptionShow(visible);
|
|
826
844
|
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
|
}
|
package/lib/card/card.js
CHANGED
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
12
|
+
var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));
|
|
12
13
|
var React = _interopRequireWildcard(require("react"));
|
|
13
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
15
|
var _checkbox = _interopRequireDefault(require("../checkbox"));
|
|
@@ -16,37 +17,46 @@ var _utils = require("../_utils");
|
|
|
16
17
|
var _configProvider = require("../config-provider");
|
|
17
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
21
|
+
var t = {};
|
|
22
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
23
|
+
if (s != null && typeof _getOwnPropertySymbols.default === "function") for (var i = 0, p = (0, _getOwnPropertySymbols.default)(s); i < p.length; i++) {
|
|
24
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
25
|
+
}
|
|
26
|
+
return t;
|
|
27
|
+
};
|
|
19
28
|
var Card = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
20
29
|
var _React$useContext = React.useContext(_configProvider.ConfigContext),
|
|
21
30
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
22
31
|
pkgPrefixCls = _React$useContext.prefixCls,
|
|
23
32
|
userDefaultProps = _React$useContext.compDefaultProps;
|
|
24
33
|
// 属性需要合并一遍用户定义的默认属性
|
|
25
|
-
var
|
|
26
|
-
tags =
|
|
27
|
-
style =
|
|
28
|
-
title =
|
|
29
|
-
avatar =
|
|
30
|
-
actions =
|
|
31
|
-
extra =
|
|
32
|
-
children =
|
|
33
|
-
className =
|
|
34
|
-
hoverable =
|
|
35
|
-
headStyle =
|
|
36
|
-
bodyStyle =
|
|
37
|
-
selectable =
|
|
38
|
-
checkboxProps =
|
|
39
|
-
customPrefixcls =
|
|
34
|
+
var _a = (0, _utils.getCompProps)('Card', userDefaultProps, props),
|
|
35
|
+
tags = _a.tags,
|
|
36
|
+
style = _a.style,
|
|
37
|
+
title = _a.title,
|
|
38
|
+
avatar = _a.avatar,
|
|
39
|
+
actions = _a.actions,
|
|
40
|
+
extra = _a.extra,
|
|
41
|
+
children = _a.children,
|
|
42
|
+
className = _a.className,
|
|
43
|
+
hoverable = _a.hoverable,
|
|
44
|
+
headStyle = _a.headStyle,
|
|
45
|
+
bodyStyle = _a.bodyStyle,
|
|
46
|
+
selectable = _a.selectable,
|
|
47
|
+
checkboxProps = _a.checkboxProps,
|
|
48
|
+
customPrefixcls = _a.prefixCls,
|
|
49
|
+
others = __rest(_a, ["tags", "style", "title", "avatar", "actions", "extra", "children", "className", "hoverable", "headStyle", "bodyStyle", "selectable", "checkboxProps", "prefixCls"]);
|
|
40
50
|
// className前缀
|
|
41
51
|
var prefixCls = getPrefixCls(pkgPrefixCls, 'card', customPrefixcls);
|
|
42
52
|
var cardClassName = (0, _classnames.default)(prefixCls, {
|
|
43
53
|
hoverable: hoverable
|
|
44
54
|
}, className);
|
|
45
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2.default)({
|
|
46
56
|
ref: ref,
|
|
47
57
|
className: cardClassName,
|
|
48
58
|
style: style
|
|
49
|
-
}, title && !avatar && /*#__PURE__*/React.createElement("header", {
|
|
59
|
+
}, others), title && !avatar && /*#__PURE__*/React.createElement("header", {
|
|
50
60
|
className: "".concat(prefixCls, "-header"),
|
|
51
61
|
style: headStyle
|
|
52
62
|
}, title), avatar && /*#__PURE__*/React.createElement("header", {
|
package/lib/carousel/carousel.js
CHANGED
|
@@ -88,8 +88,8 @@ var InternalCarousel = function InternalCarousel(props, ref) {
|
|
|
88
88
|
var setScrollXEffectStyle = _react.default.useCallback(function () {
|
|
89
89
|
var _context;
|
|
90
90
|
if (!listRef.current) return;
|
|
91
|
-
listRef.current.style.cssText = needAnimation ? (0, _concat.default)(_context = "transform: translateX(".concat(posX, "px); transition:all 0.3s ")).call(_context, easing) : "transform: translateX(".concat(posX, "px); transition:
|
|
92
|
-
}, [needAnimation, easing, posX]);
|
|
91
|
+
listRef.current.style.cssText = needAnimation ? (0, _concat.default)(_context = "transform: translateX(".concat(posX, "px); transition:all 0.3s ")).call(_context, easing) : "transform: translateX(".concat(posX, "px); transition:none");
|
|
92
|
+
}, [children === null || children === void 0 ? void 0 : children.length, needAnimation, easing, posX]);
|
|
93
93
|
var jumpTo = _react.default.useCallback(function (index, needAnimation) {
|
|
94
94
|
if (isFadeEffect) {
|
|
95
95
|
if (index === -1 || index === children.length) index = 0;
|
|
@@ -227,6 +227,7 @@ var InternalCarousel = function InternalCarousel(props, ref) {
|
|
|
227
227
|
content = /*#__PURE__*/_react.default.createElement(_slideList.SlideList, {
|
|
228
228
|
items: children,
|
|
229
229
|
parentPrefixCls: carouselPrefixCls,
|
|
230
|
+
currentIndex: currentIndex,
|
|
230
231
|
ref: listRef
|
|
231
232
|
});
|
|
232
233
|
}
|
|
@@ -5,14 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.SlideList = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
8
9
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
9
10
|
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
10
11
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
13
|
var _react = _interopRequireDefault(require("react"));
|
|
12
14
|
var SlideList = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
13
15
|
var _context2;
|
|
14
16
|
var items = props.items,
|
|
15
|
-
parentPrefixCls = props.parentPrefixCls
|
|
17
|
+
parentPrefixCls = props.parentPrefixCls,
|
|
18
|
+
currentIndex = props.currentIndex;
|
|
16
19
|
var slideListPrefixCls = "".concat(parentPrefixCls, "-list-slide");
|
|
17
20
|
var listPrefixCls = "".concat(parentPrefixCls, "-list");
|
|
18
21
|
var renderItems = function renderItems() {
|
|
@@ -20,7 +23,7 @@ var SlideList = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
20
23
|
var _items = (0, _concat.default)(_context = (0, _slice.default)(items).call(items, -1)).call(_context, items, (0, _slice.default)(items).call(items, 0, 1)); // 首位分别添加一项
|
|
21
24
|
return (0, _map.default)(_items).call(_items, function (item, index) {
|
|
22
25
|
return /*#__PURE__*/_react.default.createElement("li", {
|
|
23
|
-
className: "".concat(listPrefixCls, "-item"),
|
|
26
|
+
className: (0, _classnames.default)("".concat(listPrefixCls, "-item"), (0, _defineProperty2.default)({}, "".concat(listPrefixCls, "-item-active"), currentIndex === index - 1)),
|
|
24
27
|
key: index
|
|
25
28
|
}, item);
|
|
26
29
|
});
|
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) {
|
|
@@ -437,7 +436,7 @@ var Cascader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
437
436
|
trigger: 'click',
|
|
438
437
|
getPopupContainer: getPopupContainer,
|
|
439
438
|
prefixCls: "".concat(prefixCls, "-menus"),
|
|
440
|
-
placement: allProps.popperPlacement ||
|
|
439
|
+
placement: allProps.popperPlacement || popupPlacement,
|
|
441
440
|
popperClassName: allProps.popperClassName || allProps.popupClassName,
|
|
442
441
|
getTriggerElement: function getTriggerElement() {
|
|
443
442
|
return triggerRef.current;
|