@kdcloudjs/kdesign 1.7.13 → 1.7.14
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 +29 -0
- package/dist/kdesign-complete.less +1 -0
- package/dist/kdesign.css +2 -1
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +293 -172
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +2 -2
- package/dist/kdesign.min.js +5 -5
- package/dist/kdesign.min.js.map +1 -1
- package/es/empty/defaultEmptyImg.d.ts +1 -1
- package/es/empty/defaultEmptyImg.js +3 -2
- package/es/empty/empty.js +3 -1
- package/es/empty/illustrationEmptyImg.d.ts +1 -1
- package/es/empty/illustrationEmptyImg.js +3 -2
- package/es/input/style/index.css +1 -0
- package/es/input/style/index.less +1 -0
- package/es/select/option.d.ts +2 -0
- package/es/select/option.js +10 -3
- package/es/select/select.js +119 -12
- package/lib/empty/defaultEmptyImg.d.ts +1 -1
- package/lib/empty/defaultEmptyImg.js +3 -2
- package/lib/empty/empty.js +3 -1
- package/lib/empty/illustrationEmptyImg.d.ts +1 -1
- package/lib/empty/illustrationEmptyImg.js +3 -2
- package/lib/input/style/index.css +1 -0
- package/lib/input/style/index.less +1 -0
- package/lib/select/option.d.ts +2 -0
- package/lib/select/option.js +10 -3
- package/lib/select/select.js +119 -12
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import ConfigContext from '../config-provider/ConfigContext';
|
|
3
3
|
import uniqueId from 'lodash/uniqueId';
|
|
4
|
-
function DefaultEmptyImg() {
|
|
4
|
+
function DefaultEmptyImg(props) {
|
|
5
5
|
var _useContext = useContext(ConfigContext),
|
|
6
6
|
getPrefixCls = _useContext.getPrefixCls,
|
|
7
7
|
prefixCls = _useContext.prefixCls;
|
|
@@ -13,7 +13,8 @@ function DefaultEmptyImg() {
|
|
|
13
13
|
height: "96px",
|
|
14
14
|
viewBox: "0 0 168 96",
|
|
15
15
|
version: "1.1",
|
|
16
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
+
style: props.style
|
|
17
18
|
}, /*#__PURE__*/React.createElement("title", null, "\u7F16\u7EC4"), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
18
19
|
x1: "50%",
|
|
19
20
|
y1: "0%",
|
package/es/empty/empty.js
CHANGED
|
@@ -45,7 +45,9 @@ var InteranalEmpty = function InteranalEmpty(props, ref) {
|
|
|
45
45
|
className: imgClasses,
|
|
46
46
|
style: imageStyle,
|
|
47
47
|
alt: "empty"
|
|
48
|
-
}) : image
|
|
48
|
+
}) : typeof image === 'boolean' ? null : /*#__PURE__*/React.cloneElement(image, {
|
|
49
|
+
style: imageStyle
|
|
50
|
+
});
|
|
49
51
|
var descriptionNode = description === undefined ? /*#__PURE__*/React.createElement("div", {
|
|
50
52
|
className: "".concat(emptyPrefixCls, "-description")
|
|
51
53
|
}, emptyLangMsg.emptyText) : description ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import ConfigContext from '../config-provider/ConfigContext';
|
|
3
3
|
import uniqueId from 'lodash/uniqueId';
|
|
4
|
-
function IllustrationEmptyImg() {
|
|
4
|
+
function IllustrationEmptyImg(props) {
|
|
5
5
|
var _useContext = useContext(ConfigContext),
|
|
6
6
|
getPrefixCls = _useContext.getPrefixCls,
|
|
7
7
|
prefixCls = _useContext.prefixCls;
|
|
@@ -13,7 +13,8 @@ function IllustrationEmptyImg() {
|
|
|
13
13
|
height: "114px",
|
|
14
14
|
viewBox: "0 0 200 114",
|
|
15
15
|
version: "1.1",
|
|
16
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
+
style: props.style
|
|
17
18
|
}, /*#__PURE__*/React.createElement("title", null, "\u5207\u7247"), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("rect", {
|
|
18
19
|
id: "path-1",
|
|
19
20
|
x: "0",
|
package/es/input/style/index.css
CHANGED
package/es/select/option.d.ts
CHANGED
|
@@ -8,9 +8,11 @@ export interface ISelectOptionProps {
|
|
|
8
8
|
children?: any;
|
|
9
9
|
className?: string;
|
|
10
10
|
index?: number;
|
|
11
|
+
activeIndex?: number;
|
|
11
12
|
style?: React.CSSProperties;
|
|
12
13
|
isMultiple?: boolean;
|
|
13
14
|
onChangeSelect?: (key: SelectValue, label: string | undefined, isSelected: boolean) => void;
|
|
15
|
+
onChangeActiveIndex?: (index: any) => void;
|
|
14
16
|
}
|
|
15
17
|
declare const Option: React.ForwardRefExoticComponent<ISelectOptionProps & React.RefAttributes<unknown>>;
|
|
16
18
|
export default Option;
|
package/es/select/option.js
CHANGED
|
@@ -22,7 +22,10 @@ var InternalOption = function InternalOption(props, ref) {
|
|
|
22
22
|
values = _valuesInstanceProperty(props),
|
|
23
23
|
isMultiple = props.isMultiple,
|
|
24
24
|
onChangeSelect = props.onChangeSelect,
|
|
25
|
-
|
|
25
|
+
onChangeActiveIndex = props.onChangeActiveIndex,
|
|
26
|
+
title = props.title,
|
|
27
|
+
activeIndex = props.activeIndex,
|
|
28
|
+
index = props.index;
|
|
26
29
|
var optionProps = _extends({}, props);
|
|
27
30
|
var _useContext = useContext(ConfigContext),
|
|
28
31
|
getPrefixCls = _useContext.getPrefixCls,
|
|
@@ -35,7 +38,7 @@ var InternalOption = function InternalOption(props, ref) {
|
|
|
35
38
|
setSelected(value !== undefined ? value === values : false);
|
|
36
39
|
}
|
|
37
40
|
});
|
|
38
|
-
var optionCls = classNames(selectOptionPrefixCls, className, (_classNames = {}, _defineProperty(_classNames, "".concat(selectOptionPrefixCls, "-option"), true), _defineProperty(_classNames, "".concat(selectOptionPrefixCls, "-option-selected"), isSelected), _defineProperty(_classNames, "".concat(selectOptionPrefixCls, "-option-disabled"), disabled), _classNames));
|
|
41
|
+
var optionCls = classNames(selectOptionPrefixCls, className, (_classNames = {}, _defineProperty(_classNames, "".concat(selectOptionPrefixCls, "-option"), true), _defineProperty(_classNames, "".concat(selectOptionPrefixCls, "-option-active"), activeIndex === index), _defineProperty(_classNames, "".concat(selectOptionPrefixCls, "-option-selected"), isSelected), _defineProperty(_classNames, "".concat(selectOptionPrefixCls, "-option-disabled"), disabled), _classNames));
|
|
39
42
|
var contentCls = classNames(_defineProperty({}, "".concat(selectOptionPrefixCls, "-option-content"), true));
|
|
40
43
|
var handleClick = function handleClick(e) {
|
|
41
44
|
e.preventDefault();
|
|
@@ -45,6 +48,9 @@ var InternalOption = function InternalOption(props, ref) {
|
|
|
45
48
|
}
|
|
46
49
|
onChangeSelect && onChangeSelect(value, children, isSelected);
|
|
47
50
|
};
|
|
51
|
+
var handleOnMouseMove = function handleOnMouseMove() {
|
|
52
|
+
onChangeActiveIndex && onChangeActiveIndex(index);
|
|
53
|
+
};
|
|
48
54
|
var titleText = title || (_typeof(children) !== 'object' ? children : null);
|
|
49
55
|
var checkStyle = {
|
|
50
56
|
minHeight: '22px',
|
|
@@ -54,7 +60,8 @@ var InternalOption = function InternalOption(props, ref) {
|
|
|
54
60
|
ref: optionRef,
|
|
55
61
|
className: optionCls,
|
|
56
62
|
title: titleText,
|
|
57
|
-
onClick: handleClick
|
|
63
|
+
onClick: handleClick,
|
|
64
|
+
onMouseMove: handleOnMouseMove
|
|
58
65
|
}, /*#__PURE__*/React.createElement("div", {
|
|
59
66
|
className: contentCls
|
|
60
67
|
}, isMultiple ? /*#__PURE__*/React.createElement(Checkbox, {
|
package/es/select/select.js
CHANGED
|
@@ -7,6 +7,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
|
|
|
7
7
|
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
8
8
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
9
9
|
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
|
|
10
|
+
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
|
|
10
11
|
import React, { useContext, useRef, useEffect, useState, useCallback, useLayoutEffect, useMemo } from 'react';
|
|
11
12
|
import { useMergedState } from '../_utils/hooks';
|
|
12
13
|
import isBoolean from 'lodash/isBoolean';
|
|
@@ -18,6 +19,7 @@ import { Icon, Checkbox, Tag } from '../index';
|
|
|
18
19
|
import Option from './option';
|
|
19
20
|
import usePopper from '../_utils/usePopper';
|
|
20
21
|
import VirtualList from '../virtual-list';
|
|
22
|
+
import KeyCode from '../_utils/KeyCode';
|
|
21
23
|
var INPUT_MIN_WIDTH = 4; // 输入框最小宽度
|
|
22
24
|
var InternalSelect = function InternalSelect(props, ref) {
|
|
23
25
|
var _context, _classNames6, _classNames12;
|
|
@@ -200,13 +202,13 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
200
202
|
onBlur && onBlur(e);
|
|
201
203
|
}, [onBlur]);
|
|
202
204
|
// 点击组件
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
205
|
+
// const handleClick = () => {
|
|
206
|
+
// if (disabled) return
|
|
207
|
+
// if (optionShow) {
|
|
208
|
+
// const { onDropdownVisibleChange } = selectProps
|
|
209
|
+
// onDropdownVisibleChange && onDropdownVisibleChange(true)
|
|
210
|
+
// }
|
|
211
|
+
// }
|
|
210
212
|
useEffect(function () {
|
|
211
213
|
selectionRef.current.addEventListener('mouseup', function (e) {
|
|
212
214
|
var _a;
|
|
@@ -460,8 +462,12 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
460
462
|
}, child.props, {
|
|
461
463
|
key: index,
|
|
462
464
|
index: index,
|
|
465
|
+
activeIndex: activeIndex,
|
|
463
466
|
onChangeSelect: handleOption,
|
|
464
|
-
values: multipleRef.current.selectedVal
|
|
467
|
+
values: multipleRef.current.selectedVal,
|
|
468
|
+
onChangeActiveIndex: function onChangeActiveIndex(i) {
|
|
469
|
+
setActiveIndex(i);
|
|
470
|
+
}
|
|
465
471
|
}));
|
|
466
472
|
} else {
|
|
467
473
|
return /*#__PURE__*/React.createElement(Option, _extends({
|
|
@@ -469,8 +475,12 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
469
475
|
value: child === null || child === void 0 ? void 0 : child.value,
|
|
470
476
|
key: index,
|
|
471
477
|
index: index,
|
|
478
|
+
activeIndex: activeIndex,
|
|
472
479
|
onChangeSelect: handleOption,
|
|
473
|
-
values: multipleRef.current.selectedVal
|
|
480
|
+
values: multipleRef.current.selectedVal,
|
|
481
|
+
onChangeActiveIndex: function onChangeActiveIndex(i) {
|
|
482
|
+
setActiveIndex(i);
|
|
483
|
+
}
|
|
474
484
|
}, child), (child === null || child === void 0 ? void 0 : child.label) || (child === null || child === void 0 ? void 0 : child.value));
|
|
475
485
|
}
|
|
476
486
|
};
|
|
@@ -499,6 +509,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
499
509
|
(_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
500
510
|
}
|
|
501
511
|
}, [isShowSearch, autoFocus, disabled]);
|
|
512
|
+
var optionsListRef = React.useRef(null);
|
|
502
513
|
// 渲染下拉列表框
|
|
503
514
|
var renderContent = function renderContent() {
|
|
504
515
|
var dropdownRender = selectProps.dropdownRender,
|
|
@@ -524,7 +535,8 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
524
535
|
},
|
|
525
536
|
isStaticItemHeight: true,
|
|
526
537
|
height: listHeight || 300,
|
|
527
|
-
measureLongestItem: false
|
|
538
|
+
measureLongestItem: false,
|
|
539
|
+
ref: optionsListRef
|
|
528
540
|
}, virtualListProps), function (child) {
|
|
529
541
|
return child;
|
|
530
542
|
});
|
|
@@ -683,6 +695,101 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
683
695
|
}, renderSuffix()));
|
|
684
696
|
};
|
|
685
697
|
var singleCls = classNames(commCls, (_classNames12 = {}, _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single"), true), _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single-disabled"), disabled), _defineProperty(_classNames12, "".concat(selectPrefixCls, "-single-focused"), focusd && !disabled || optionShow), _classNames12));
|
|
698
|
+
// keyboard
|
|
699
|
+
var getActiveIndex = function getActiveIndex(index) {
|
|
700
|
+
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
701
|
+
var len = filledOptions.length;
|
|
702
|
+
for (var i = 0; i < len; i += 1) {
|
|
703
|
+
var current = (index + i * offset + len) % len;
|
|
704
|
+
var _props = filledOptions[current].props;
|
|
705
|
+
if (!(_props === null || _props === void 0 ? void 0 : _props.disabled)) {
|
|
706
|
+
return current;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
return -1;
|
|
710
|
+
};
|
|
711
|
+
// reset activeIndex
|
|
712
|
+
useEffect(function () {
|
|
713
|
+
if (searchValue) {
|
|
714
|
+
setActiveIndex(getActiveIndex(0));
|
|
715
|
+
}
|
|
716
|
+
}, [searchValue]);
|
|
717
|
+
useEffect(function () {
|
|
718
|
+
if (optionShow && !disabled) {
|
|
719
|
+
var onDropdownVisibleChange = selectProps.onDropdownVisibleChange;
|
|
720
|
+
onDropdownVisibleChange && onDropdownVisibleChange(true);
|
|
721
|
+
}
|
|
722
|
+
}, [optionShow]);
|
|
723
|
+
var _useState13 = useState(getActiveIndex(0)),
|
|
724
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
725
|
+
activeIndex = _useState14[0],
|
|
726
|
+
setActiveIndex = _useState14[1];
|
|
727
|
+
var onInternalKeyDown = function onInternalKeyDown(e) {
|
|
728
|
+
var _a, _b;
|
|
729
|
+
var which = e.which;
|
|
730
|
+
// open
|
|
731
|
+
if (which === KeyCode.ENTER || which === KeyCode.UP || which === KeyCode.DOWN) {
|
|
732
|
+
e.preventDefault();
|
|
733
|
+
setOptionShow(true);
|
|
734
|
+
}
|
|
735
|
+
// backspace
|
|
736
|
+
var _multipleRef$current5 = multipleRef.current,
|
|
737
|
+
selectedVal = _multipleRef$current5.selectedVal,
|
|
738
|
+
selectMulOpts = _multipleRef$current5.selectMulOpts;
|
|
739
|
+
// isMultiple
|
|
740
|
+
if (which === KeyCode.BACKSPACE && !searchValue && isMultiple && selectedVal.length && selectMulOpts.length) {
|
|
741
|
+
_spliceInstanceProperty(selectedVal).call(selectedVal, -1, 1);
|
|
742
|
+
_spliceInstanceProperty(selectMulOpts).call(selectMulOpts, -1, 1);
|
|
743
|
+
setMulOptions(_toConsumableArray(selectMulOpts));
|
|
744
|
+
onChange && onChange(labelInValue ? selectMulOpts : selectedVal, selectMulOpts);
|
|
745
|
+
// !isMultiple
|
|
746
|
+
} else if (which === KeyCode.BACKSPACE && allowClear && !isMultiple) {
|
|
747
|
+
setInitValue('');
|
|
748
|
+
onClear && onClear('');
|
|
749
|
+
setSearchValue('');
|
|
750
|
+
onChange && onChange(undefined);
|
|
751
|
+
}
|
|
752
|
+
// optionsList: up、down、enter
|
|
753
|
+
if (optionShow) {
|
|
754
|
+
var offset = 0;
|
|
755
|
+
if (which === KeyCode.UP) {
|
|
756
|
+
offset = -1;
|
|
757
|
+
} else if (which === KeyCode.DOWN) {
|
|
758
|
+
offset = 1;
|
|
759
|
+
} else if (which === KeyCode.ENTER) {
|
|
760
|
+
var item = filledOptions[activeIndex];
|
|
761
|
+
var key = ((_a = item.props) === null || _a === void 0 ? void 0 : _a.value) || item.value;
|
|
762
|
+
var label = ((_b = item.props) === null || _b === void 0 ? void 0 : _b.children) || item.label;
|
|
763
|
+
handleOption(key, label, true);
|
|
764
|
+
// search
|
|
765
|
+
if (searchValue) {
|
|
766
|
+
setActiveIndex(_findIndexInstanceProperty(realChildren).call(realChildren, function (child) {
|
|
767
|
+
var _a;
|
|
768
|
+
if (child && child.props) {
|
|
769
|
+
return ((_a = child.props) === null || _a === void 0 ? void 0 : _a.value) === key;
|
|
770
|
+
} else {
|
|
771
|
+
return (child === null || child === void 0 ? void 0 : child.value) === key;
|
|
772
|
+
}
|
|
773
|
+
}));
|
|
774
|
+
}
|
|
775
|
+
if (!isMultiple) {
|
|
776
|
+
setOptionShow(false);
|
|
777
|
+
}
|
|
778
|
+
} else if (which === KeyCode.ESC) {
|
|
779
|
+
setOptionShow(false);
|
|
780
|
+
}
|
|
781
|
+
if (offset !== 0) {
|
|
782
|
+
var nextActiveIndex = getActiveIndex(activeIndex + offset, offset);
|
|
783
|
+
if (optionsListRef.current) {
|
|
784
|
+
optionsListRef.current.scrollTo({
|
|
785
|
+
index: nextActiveIndex
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
setActiveIndex(nextActiveIndex);
|
|
789
|
+
e.preventDefault();
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
};
|
|
686
793
|
var renderSelect = function renderSelect() {
|
|
687
794
|
return /*#__PURE__*/React.createElement("div", {
|
|
688
795
|
className: selectCls,
|
|
@@ -690,7 +797,6 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
690
797
|
style: style
|
|
691
798
|
}, /*#__PURE__*/React.createElement("span", {
|
|
692
799
|
className: selectionCls,
|
|
693
|
-
onClick: handleClick,
|
|
694
800
|
tabIndex: disabled ? -1 : 0,
|
|
695
801
|
onFocus: function onFocus() {
|
|
696
802
|
var _a;
|
|
@@ -699,7 +805,8 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
699
805
|
onBlur: function onBlur() {
|
|
700
806
|
var _a;
|
|
701
807
|
return (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
702
|
-
}
|
|
808
|
+
},
|
|
809
|
+
onKeyDown: onInternalKeyDown
|
|
703
810
|
}, !isMultiple ? renderSingle() : renderMultiple()));
|
|
704
811
|
};
|
|
705
812
|
var catchStyle = function catchStyle() {
|
|
@@ -13,7 +13,7 @@ var _ConfigContext = _interopRequireDefault(require("../config-provider/ConfigCo
|
|
|
13
13
|
var _uniqueId = _interopRequireDefault(require("lodash/uniqueId"));
|
|
14
14
|
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); }
|
|
15
15
|
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; }
|
|
16
|
-
function DefaultEmptyImg() {
|
|
16
|
+
function DefaultEmptyImg(props) {
|
|
17
17
|
var _useContext = (0, _react.useContext)(_ConfigContext.default),
|
|
18
18
|
getPrefixCls = _useContext.getPrefixCls,
|
|
19
19
|
prefixCls = _useContext.prefixCls;
|
|
@@ -25,7 +25,8 @@ function DefaultEmptyImg() {
|
|
|
25
25
|
height: "96px",
|
|
26
26
|
viewBox: "0 0 168 96",
|
|
27
27
|
version: "1.1",
|
|
28
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
28
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
29
|
+
style: props.style
|
|
29
30
|
}, /*#__PURE__*/_react.default.createElement("title", null, "\u7F16\u7EC4"), /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("linearGradient", {
|
|
30
31
|
x1: "50%",
|
|
31
32
|
y1: "0%",
|
package/lib/empty/empty.js
CHANGED
|
@@ -57,7 +57,9 @@ var InteranalEmpty = function InteranalEmpty(props, ref) {
|
|
|
57
57
|
className: imgClasses,
|
|
58
58
|
style: imageStyle,
|
|
59
59
|
alt: "empty"
|
|
60
|
-
}) : image
|
|
60
|
+
}) : typeof image === 'boolean' ? null : /*#__PURE__*/_react.default.cloneElement(image, {
|
|
61
|
+
style: imageStyle
|
|
62
|
+
});
|
|
61
63
|
var descriptionNode = description === undefined ? /*#__PURE__*/_react.default.createElement("div", {
|
|
62
64
|
className: "".concat(emptyPrefixCls, "-description")
|
|
63
65
|
}, emptyLangMsg.emptyText) : description ? /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -13,7 +13,7 @@ var _ConfigContext = _interopRequireDefault(require("../config-provider/ConfigCo
|
|
|
13
13
|
var _uniqueId = _interopRequireDefault(require("lodash/uniqueId"));
|
|
14
14
|
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); }
|
|
15
15
|
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; }
|
|
16
|
-
function IllustrationEmptyImg() {
|
|
16
|
+
function IllustrationEmptyImg(props) {
|
|
17
17
|
var _useContext = (0, _react.useContext)(_ConfigContext.default),
|
|
18
18
|
getPrefixCls = _useContext.getPrefixCls,
|
|
19
19
|
prefixCls = _useContext.prefixCls;
|
|
@@ -25,7 +25,8 @@ function IllustrationEmptyImg() {
|
|
|
25
25
|
height: "114px",
|
|
26
26
|
viewBox: "0 0 200 114",
|
|
27
27
|
version: "1.1",
|
|
28
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
28
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
29
|
+
style: props.style
|
|
29
30
|
}, /*#__PURE__*/_react.default.createElement("title", null, "\u5207\u7247"), /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("rect", {
|
|
30
31
|
id: "path-1",
|
|
31
32
|
x: "0",
|
package/lib/select/option.d.ts
CHANGED
|
@@ -8,9 +8,11 @@ export interface ISelectOptionProps {
|
|
|
8
8
|
children?: any;
|
|
9
9
|
className?: string;
|
|
10
10
|
index?: number;
|
|
11
|
+
activeIndex?: number;
|
|
11
12
|
style?: React.CSSProperties;
|
|
12
13
|
isMultiple?: boolean;
|
|
13
14
|
onChangeSelect?: (key: SelectValue, label: string | undefined, isSelected: boolean) => void;
|
|
15
|
+
onChangeActiveIndex?: (index: any) => void;
|
|
14
16
|
}
|
|
15
17
|
declare const Option: React.ForwardRefExoticComponent<ISelectOptionProps & React.RefAttributes<unknown>>;
|
|
16
18
|
export default Option;
|
package/lib/select/option.js
CHANGED
|
@@ -34,7 +34,10 @@ var InternalOption = function InternalOption(props, ref) {
|
|
|
34
34
|
values = (0, _values.default)(props),
|
|
35
35
|
isMultiple = props.isMultiple,
|
|
36
36
|
onChangeSelect = props.onChangeSelect,
|
|
37
|
-
|
|
37
|
+
onChangeActiveIndex = props.onChangeActiveIndex,
|
|
38
|
+
title = props.title,
|
|
39
|
+
activeIndex = props.activeIndex,
|
|
40
|
+
index = props.index;
|
|
38
41
|
var optionProps = (0, _extends2.default)({}, props);
|
|
39
42
|
var _useContext = (0, _react.useContext)(_ConfigContext.default),
|
|
40
43
|
getPrefixCls = _useContext.getPrefixCls,
|
|
@@ -47,7 +50,7 @@ var InternalOption = function InternalOption(props, ref) {
|
|
|
47
50
|
setSelected(value !== undefined ? value === values : false);
|
|
48
51
|
}
|
|
49
52
|
});
|
|
50
|
-
var optionCls = (0, _classnames.default)(selectOptionPrefixCls, className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(selectOptionPrefixCls, "-option"), true), (0, _defineProperty2.default)(_classNames, "".concat(selectOptionPrefixCls, "-option-selected"), isSelected), (0, _defineProperty2.default)(_classNames, "".concat(selectOptionPrefixCls, "-option-disabled"), disabled), _classNames));
|
|
53
|
+
var optionCls = (0, _classnames.default)(selectOptionPrefixCls, className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(selectOptionPrefixCls, "-option"), true), (0, _defineProperty2.default)(_classNames, "".concat(selectOptionPrefixCls, "-option-active"), activeIndex === index), (0, _defineProperty2.default)(_classNames, "".concat(selectOptionPrefixCls, "-option-selected"), isSelected), (0, _defineProperty2.default)(_classNames, "".concat(selectOptionPrefixCls, "-option-disabled"), disabled), _classNames));
|
|
51
54
|
var contentCls = (0, _classnames.default)((0, _defineProperty2.default)({}, "".concat(selectOptionPrefixCls, "-option-content"), true));
|
|
52
55
|
var handleClick = function handleClick(e) {
|
|
53
56
|
e.preventDefault();
|
|
@@ -57,6 +60,9 @@ var InternalOption = function InternalOption(props, ref) {
|
|
|
57
60
|
}
|
|
58
61
|
onChangeSelect && onChangeSelect(value, children, isSelected);
|
|
59
62
|
};
|
|
63
|
+
var handleOnMouseMove = function handleOnMouseMove() {
|
|
64
|
+
onChangeActiveIndex && onChangeActiveIndex(index);
|
|
65
|
+
};
|
|
60
66
|
var titleText = title || ((0, _typeof2.default)(children) !== 'object' ? children : null);
|
|
61
67
|
var checkStyle = {
|
|
62
68
|
minHeight: '22px',
|
|
@@ -66,7 +72,8 @@ var InternalOption = function InternalOption(props, ref) {
|
|
|
66
72
|
ref: optionRef,
|
|
67
73
|
className: optionCls,
|
|
68
74
|
title: titleText,
|
|
69
|
-
onClick: handleClick
|
|
75
|
+
onClick: handleClick,
|
|
76
|
+
onMouseMove: handleOnMouseMove
|
|
70
77
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
71
78
|
className: contentCls
|
|
72
79
|
}, isMultiple ? /*#__PURE__*/_react.default.createElement(_index.Checkbox, {
|