@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/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/es/upload/upload.js
CHANGED
|
@@ -37,7 +37,7 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
37
37
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
-
import React, { Children } from 'react';
|
|
40
|
+
import React, { Children, forwardRef, useContext, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
41
41
|
import classNames from 'classnames';
|
|
42
42
|
import ConfigContext from '../config-provider/ConfigContext';
|
|
43
43
|
import { getCompProps } from '../_utils';
|
|
@@ -73,12 +73,11 @@ function abort(file) {
|
|
|
73
73
|
}
|
|
74
74
|
var InternalUpload = function InternalUpload(props, ref) {
|
|
75
75
|
var _context5, _classNames, _context6, _context7;
|
|
76
|
-
var
|
|
77
|
-
getPrefixCls =
|
|
78
|
-
pkgPrefixCls =
|
|
79
|
-
userDefaultProps =
|
|
80
|
-
var
|
|
81
|
-
var mergedRef = ref || innerRef;
|
|
76
|
+
var _useContext = useContext(ConfigContext),
|
|
77
|
+
getPrefixCls = _useContext.getPrefixCls,
|
|
78
|
+
pkgPrefixCls = _useContext.prefixCls,
|
|
79
|
+
userDefaultProps = _useContext.compDefaultProps;
|
|
80
|
+
var inputRef = useRef(null);
|
|
82
81
|
var allProps = getCompProps('Upload', userDefaultProps, props); // 属性需要合并一遍用户定义的默认属性
|
|
83
82
|
var type = allProps.type,
|
|
84
83
|
style = allProps.style,
|
|
@@ -94,15 +93,15 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
94
93
|
showUploadList = allProps.showUploadList,
|
|
95
94
|
customPrefixcls = allProps.prefixCls,
|
|
96
95
|
onPreview = allProps.onPreview;
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
fileList =
|
|
100
|
-
setFileList =
|
|
96
|
+
var _useState = useState(props.fileList || props.defaultFileList || []),
|
|
97
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
98
|
+
fileList = _useState2[0],
|
|
99
|
+
setFileList = _useState2[1];
|
|
101
100
|
var hasChildren = children && Children.toArray(children).length > 0;
|
|
102
|
-
|
|
101
|
+
useEffect(function () {
|
|
103
102
|
props.fileList && setFileList(props.fileList);
|
|
104
103
|
}, [props.fileList]);
|
|
105
|
-
|
|
104
|
+
useEffect(function () {
|
|
106
105
|
return abort;
|
|
107
106
|
}, []);
|
|
108
107
|
var onClick = function onClick(e) {
|
|
@@ -122,20 +121,22 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
122
121
|
});
|
|
123
122
|
};
|
|
124
123
|
var uploadFiles = function uploadFiles(files) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
124
|
+
if (Array.isArray(files) && files.length) {
|
|
125
|
+
var _context2;
|
|
126
|
+
files.forEach(function (file) {
|
|
127
|
+
file.originFileObj = new File([file], file.name, {
|
|
128
|
+
type: file.type
|
|
129
|
+
});
|
|
130
|
+
file.uid = getUid();
|
|
131
|
+
file.status = 'notStart';
|
|
132
|
+
file.fileName = allProps.name || file.name;
|
|
129
133
|
});
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
props.fileList === undefined && setFileList(fileList);
|
|
137
|
-
upload(file, newFileList);
|
|
138
|
-
});
|
|
134
|
+
var newFileList = _concatInstanceProperty(_context2 = []).call(_context2, _toConsumableArray(fileList), _toConsumableArray(files));
|
|
135
|
+
files.forEach(function (file) {
|
|
136
|
+
props.fileList === undefined && setFileList(fileList);
|
|
137
|
+
upload(file, newFileList);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
139
140
|
};
|
|
140
141
|
var upload = function upload(file, fileList) {
|
|
141
142
|
if (props.beforeUpload) {
|
|
@@ -264,40 +265,53 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
264
265
|
});
|
|
265
266
|
});
|
|
266
267
|
};
|
|
267
|
-
var handleRemove = function handleRemove(
|
|
268
|
-
e.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
if (
|
|
273
|
-
var
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
268
|
+
var handleRemove = function handleRemove(originFile) {
|
|
269
|
+
var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
270
|
+
if (e) {
|
|
271
|
+
e.preventDefault();
|
|
272
|
+
}
|
|
273
|
+
if (originFile) {
|
|
274
|
+
var file = _extends(_extends({}, originFile), {
|
|
275
|
+
status: 'removed'
|
|
276
|
+
});
|
|
277
|
+
var files = _filterInstanceProperty(fileList).call(fileList, function (fileItem) {
|
|
278
|
+
return fileItem.uid !== file.uid;
|
|
279
|
+
});
|
|
280
|
+
if (onRemove) {
|
|
281
|
+
var remove = onRemove(file);
|
|
282
|
+
if (remove && typeof remove !== 'boolean' && remove.then) {
|
|
283
|
+
remove.then(function (flag) {
|
|
284
|
+
if (flag) {
|
|
285
|
+
onFileListChange(file, files);
|
|
286
|
+
abort(file);
|
|
287
|
+
}
|
|
288
|
+
}).catch(function (e) {
|
|
289
|
+
console.log(e);
|
|
290
|
+
});
|
|
291
|
+
} else if (remove !== false) {
|
|
292
|
+
onFileListChange(file, files);
|
|
293
|
+
abort(file);
|
|
294
|
+
}
|
|
295
|
+
} else {
|
|
284
296
|
onFileListChange(file, files);
|
|
285
297
|
abort(file);
|
|
286
298
|
}
|
|
287
|
-
} else {
|
|
288
|
-
onFileListChange(file, files);
|
|
289
|
-
abort(file);
|
|
290
299
|
}
|
|
291
300
|
};
|
|
292
|
-
var handleReUpload = function handleReUpload(file
|
|
293
|
-
e.
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
+
var handleReUpload = function handleReUpload(file) {
|
|
302
|
+
var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
303
|
+
if (e) {
|
|
304
|
+
e.preventDefault();
|
|
305
|
+
}
|
|
306
|
+
if (file) {
|
|
307
|
+
file.percent = 0;
|
|
308
|
+
file.status = 'uploading';
|
|
309
|
+
var files = _mapInstanceProperty(fileList).call(fileList, function (fileItem) {
|
|
310
|
+
return fileItem.uid === file.uid ? file : fileItem;
|
|
311
|
+
});
|
|
312
|
+
onFileListChange(file, files);
|
|
313
|
+
upload(file, files);
|
|
314
|
+
}
|
|
301
315
|
};
|
|
302
316
|
var prefixCls = getPrefixCls(pkgPrefixCls, 'upload', customPrefixcls);
|
|
303
317
|
var inputFileProps = {
|
|
@@ -310,10 +324,10 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
310
324
|
webkitdirectory: directory ? 'webkitdirectory' : undefined
|
|
311
325
|
};
|
|
312
326
|
var dragEvents = {};
|
|
313
|
-
var
|
|
314
|
-
|
|
315
|
-
hover =
|
|
316
|
-
setHover =
|
|
327
|
+
var _useState3 = useState(false),
|
|
328
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
329
|
+
hover = _useState4[0],
|
|
330
|
+
setHover = _useState4[1];
|
|
317
331
|
if (type === 'drag') {
|
|
318
332
|
var onFileDrop = function onFileDrop(e) {
|
|
319
333
|
e.preventDefault();
|
|
@@ -349,7 +363,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
349
363
|
dragEvents.onDragOver = onFileLeave;
|
|
350
364
|
dragEvents.onDragLeave = onFileLeave;
|
|
351
365
|
}
|
|
352
|
-
|
|
366
|
+
useEffect(function () {
|
|
353
367
|
if (type === 'drag') {
|
|
354
368
|
var stopDrop = function stopDrop(e) {
|
|
355
369
|
return e.preventDefault();
|
|
@@ -362,6 +376,16 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
362
376
|
};
|
|
363
377
|
}
|
|
364
378
|
}, [type]);
|
|
379
|
+
useImperativeHandle(ref, function () {
|
|
380
|
+
return {
|
|
381
|
+
fileList: fileList,
|
|
382
|
+
uploadFiles: uploadFiles,
|
|
383
|
+
reUploadFile: handleReUpload,
|
|
384
|
+
removeFile: handleRemove,
|
|
385
|
+
abortFile: abort,
|
|
386
|
+
input: inputRef.current
|
|
387
|
+
};
|
|
388
|
+
});
|
|
365
389
|
return /*#__PURE__*/React.createElement("div", {
|
|
366
390
|
className: classNames(prefixCls, {
|
|
367
391
|
disabled: disabled
|
|
@@ -377,7 +401,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
377
401
|
title: "",
|
|
378
402
|
type: "file"
|
|
379
403
|
}, inputFileProps, {
|
|
380
|
-
ref:
|
|
404
|
+
ref: inputRef
|
|
381
405
|
})))), (listType === 'picture' || !(listType === 'text' && (!showUploadList || !fileList.length))) && /*#__PURE__*/React.createElement("ul", {
|
|
382
406
|
className: _concatInstanceProperty(_context6 = "".concat(prefixCls, "-")).call(_context6, listType, "-list")
|
|
383
407
|
}, listType === 'picture' && hasChildren && /*#__PURE__*/React.createElement("li", {
|
|
@@ -392,7 +416,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
392
416
|
title: "",
|
|
393
417
|
type: "file"
|
|
394
418
|
}, inputFileProps, {
|
|
395
|
-
ref:
|
|
419
|
+
ref: inputRef
|
|
396
420
|
}))))), showUploadList && _mapInstanceProperty(fileList).call(fileList, function (file) {
|
|
397
421
|
return itemRender ? itemRender( /*#__PURE__*/React.createElement(Item, _extends({}, {
|
|
398
422
|
file: file,
|
|
@@ -502,6 +526,6 @@ var Item = function Item(_ref3) {
|
|
|
502
526
|
})]
|
|
503
527
|
}));
|
|
504
528
|
};
|
|
505
|
-
var Upload = /*#__PURE__*/
|
|
529
|
+
var Upload = /*#__PURE__*/forwardRef(InternalUpload);
|
|
506
530
|
Upload.displayName = 'Upload';
|
|
507
531
|
export default Upload;
|
|
@@ -167,9 +167,11 @@
|
|
|
167
167
|
}
|
|
168
168
|
.kd-carousel-list-fade .kd-carousel-list-item-not-hidden {
|
|
169
169
|
opacity: 1;
|
|
170
|
+
z-index: 1;
|
|
170
171
|
}
|
|
171
172
|
.kd-carousel-list-fade .kd-carousel-list-item-hidden {
|
|
172
173
|
opacity: 0;
|
|
174
|
+
z-index: 0;
|
|
173
175
|
}
|
|
174
176
|
.kd-carousel-list-display {
|
|
175
177
|
width: 100%;
|
|
@@ -187,6 +189,7 @@
|
|
|
187
189
|
position: absolute;
|
|
188
190
|
list-style: none;
|
|
189
191
|
padding: 0;
|
|
192
|
+
z-index: 1;
|
|
190
193
|
}
|
|
191
194
|
.kd-carousel-slidebar-left {
|
|
192
195
|
display: -webkit-box;
|
|
@@ -299,6 +302,7 @@
|
|
|
299
302
|
right: 16px;
|
|
300
303
|
-webkit-transform: translateY(-50%);
|
|
301
304
|
transform: translateY(-50%);
|
|
305
|
+
z-index: 1;
|
|
302
306
|
}
|
|
303
307
|
.kd-carousel-jump-left {
|
|
304
308
|
left: 16px;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@import '../../style/themes/index';
|
|
2
2
|
@import './mixin.less';
|
|
3
3
|
@carousel-prefix-cls: ~'@{kd-prefix}-carousel';
|
|
4
|
+
|
|
4
5
|
.@{carousel-prefix-cls} {
|
|
5
6
|
&-root {
|
|
6
7
|
position: relative;
|
|
@@ -27,18 +28,23 @@
|
|
|
27
28
|
|
|
28
29
|
&-slide {
|
|
29
30
|
width: 100%;
|
|
31
|
+
|
|
30
32
|
.@{carousel-prefix-cls}-list-item {
|
|
31
33
|
opacity: 1;
|
|
32
34
|
border-radius: @carousel-boder-radius;
|
|
35
|
+
|
|
33
36
|
&-animation {
|
|
34
37
|
transition: opacity 0.3s ease;
|
|
35
38
|
}
|
|
39
|
+
|
|
36
40
|
&-none-animation {
|
|
37
41
|
transition: none;
|
|
38
42
|
}
|
|
43
|
+
|
|
39
44
|
&-not-hidden {
|
|
40
45
|
opacity: 1;
|
|
41
46
|
}
|
|
47
|
+
|
|
42
48
|
&-hidden {
|
|
43
49
|
opacity: 0;
|
|
44
50
|
}
|
|
@@ -47,30 +53,40 @@
|
|
|
47
53
|
|
|
48
54
|
&-fade {
|
|
49
55
|
flex: 1;
|
|
56
|
+
|
|
50
57
|
.@{carousel-prefix-cls}-list-item {
|
|
51
58
|
opacity: 1;
|
|
59
|
+
|
|
52
60
|
&-animation {
|
|
53
61
|
transition: opacity 0.3s ease;
|
|
54
62
|
}
|
|
63
|
+
|
|
55
64
|
&-none-animation {
|
|
56
65
|
transition: none;
|
|
57
66
|
}
|
|
67
|
+
|
|
58
68
|
&-not-hidden {
|
|
59
69
|
opacity: 1;
|
|
70
|
+
z-index: 1;
|
|
60
71
|
}
|
|
72
|
+
|
|
61
73
|
&-hidden {
|
|
62
74
|
opacity: 0;
|
|
75
|
+
z-index: 0;
|
|
63
76
|
}
|
|
64
77
|
}
|
|
65
78
|
}
|
|
66
79
|
|
|
67
80
|
&-display {
|
|
68
81
|
width: 100%;
|
|
82
|
+
|
|
69
83
|
.@{carousel-prefix-cls}-list-item {
|
|
70
84
|
display: block;
|
|
85
|
+
|
|
71
86
|
&-not-hidden {
|
|
72
87
|
display: block;
|
|
73
88
|
}
|
|
89
|
+
|
|
74
90
|
&-hidden {
|
|
75
91
|
display: none;
|
|
76
92
|
}
|
|
@@ -82,25 +98,29 @@
|
|
|
82
98
|
position: absolute;
|
|
83
99
|
list-style: none;
|
|
84
100
|
padding: 0;
|
|
101
|
+
z-index: 1;
|
|
85
102
|
|
|
86
103
|
&-left {
|
|
87
104
|
.vertical;
|
|
88
105
|
left: @carousel-dots-margin-left;
|
|
89
106
|
}
|
|
107
|
+
|
|
90
108
|
&-right {
|
|
91
109
|
.vertical;
|
|
92
110
|
right: @carousel-dots-margin-right;
|
|
93
111
|
}
|
|
112
|
+
|
|
94
113
|
&-bottom {
|
|
95
114
|
.horizontal;
|
|
96
115
|
bottom: @carousel-dots-margin-bottom;
|
|
97
116
|
}
|
|
117
|
+
|
|
98
118
|
&-top {
|
|
99
119
|
.horizontal;
|
|
100
120
|
top: @carousel-dots-margin-top;
|
|
101
121
|
}
|
|
102
122
|
|
|
103
|
-
&-dot
|
|
123
|
+
&-dot>button {
|
|
104
124
|
display: block;
|
|
105
125
|
border-radius: @carousel-dots-boder-radius;
|
|
106
126
|
box-sizing: border-box;
|
|
@@ -123,9 +143,11 @@
|
|
|
123
143
|
width: 100%;
|
|
124
144
|
cursor: pointer;
|
|
125
145
|
outline: none;
|
|
146
|
+
|
|
126
147
|
&-active {
|
|
127
148
|
opacity: 1;
|
|
128
|
-
|
|
149
|
+
|
|
150
|
+
&>button {
|
|
129
151
|
background-color: @carousel-dots-color-background-active;
|
|
130
152
|
opacity: 1;
|
|
131
153
|
}
|
|
@@ -139,6 +161,7 @@
|
|
|
139
161
|
left: unset;
|
|
140
162
|
right: 16px;
|
|
141
163
|
transform: translateY(-50%);
|
|
164
|
+
z-index: 1;
|
|
142
165
|
|
|
143
166
|
&-left {
|
|
144
167
|
left: 16px;
|
|
@@ -149,7 +172,7 @@
|
|
|
149
172
|
cursor: pointer;
|
|
150
173
|
}
|
|
151
174
|
|
|
152
|
-
|
|
175
|
+
>*:first-child {
|
|
153
176
|
display: flex;
|
|
154
177
|
align-items: center;
|
|
155
178
|
justify-content: center;
|
|
@@ -173,12 +196,14 @@
|
|
|
173
196
|
}
|
|
174
197
|
}
|
|
175
198
|
}
|
|
199
|
+
|
|
176
200
|
.vertical {
|
|
177
201
|
display: flex;
|
|
178
202
|
flex-direction: column;
|
|
179
203
|
top: 50%;
|
|
180
204
|
transform: translateY(-50%);
|
|
181
|
-
|
|
205
|
+
|
|
206
|
+
&>li {
|
|
182
207
|
margin: @carousel-dots-marigin 0;
|
|
183
208
|
width: @carousel-dots-height;
|
|
184
209
|
height: @carousel-dots-width;
|
|
@@ -190,7 +215,8 @@
|
|
|
190
215
|
flex-direction: row;
|
|
191
216
|
left: 50%;
|
|
192
217
|
transform: translateX(-50%);
|
|
193
|
-
|
|
218
|
+
|
|
219
|
+
&>li {
|
|
194
220
|
margin: 0 @carousel-dots-marigin;
|
|
195
221
|
height: @carousel-dots-height;
|
|
196
222
|
width: @carousel-dots-width;
|