@qsxy/element-plus-react 1.0.1 → 1.0.2
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/dist/Calendar/Calendar.js +12 -3
- package/dist/Calendar/Footer.js +4 -2
- package/dist/Calendar/QuarterPanel.d.ts +4 -0
- package/dist/Calendar/QuarterPanel.js +109 -0
- package/dist/Calendar/WeekPanel.js +1 -1
- package/dist/Calendar/typings.d.ts +1 -1
- package/dist/Card/Card.js +9 -4
- package/dist/Card/typings.d.ts +1 -1
- package/dist/Cascader/Cascader.js +1 -1
- package/dist/DatePicker/DatePicker.js +38 -12
- package/dist/DatePicker/DateRangePicker.js +27 -9
- package/dist/DatePicker/main.js +1 -1
- package/dist/DatePicker/typings.d.ts +1 -1
- package/dist/DateTimePicker/DateTimePicker.js +2 -2
- package/dist/Input/Input.1.d.ts +16 -0
- package/dist/Input/Input.1.js +376 -0
- package/dist/Input/Input.js +137 -121
- package/dist/Input/InputRange.js +1 -1
- package/dist/Input/TextArea.js +87 -12
- package/dist/Input/typings.d.ts +15 -5
- package/dist/Input/useComposition.d.ts +23 -0
- package/dist/Input/useComposition.js +63 -0
- package/dist/Input/utils.d.ts +6 -0
- package/dist/Input/utils.js +91 -0
- package/dist/InputNumber/InputNumber.js +1 -1
- package/dist/InputNumber/typings.d.ts +1 -1
- package/dist/Select/Option.js +30 -14
- package/dist/Select/SelectContext.d.ts +3 -4
- package/dist/Select/SelectCore.d.ts +2 -2
- package/dist/Select/SelectCore.js +164 -447
- package/dist/Select/SelectDropdown.js +67 -145
- package/dist/Select/typings.d.ts +47 -21
- package/dist/Select/useSelect.d.ts +125 -0
- package/dist/Select/useSelect.js +516 -0
- package/dist/Table/util.js +6 -5
- package/dist/Tag/Tag.js +22 -17
- package/dist/TimePicker/TimePicker.js +2 -2
- package/dist/TreeSelect/TreeSelect.js +2 -2
- package/dist/Util/aria.d.ts +25 -0
- package/dist/Util/aria.js +118 -0
- package/dist/hooks/useCalcInputWidth.d.ts +8 -0
- package/dist/hooks/useCalcInputWidth.js +30 -0
- package/dist/hooks/useComposition.d.ts +16 -0
- package/dist/hooks/useComposition.js +39 -0
- package/dist/hooks/useCursor.d.ts +2 -0
- package/dist/hooks/useCursor.js +52 -0
- package/dist/hooks/useFocusController.d.ts +27 -0
- package/dist/hooks/useFocusController.js +72 -0
- package/dist/index.css +1 -1
- package/dist/locale/en.d.ts +15 -0
- package/dist/locale/en.js +15 -0
- package/dist/locale/zhCn.d.ts +15 -0
- package/dist/locale/zhCn.js +15 -0
- package/package.json +1 -1
- package/theme-chalk/calendar/index.scss +1 -0
- package/theme-chalk/calendar/quarter-table.scss +78 -0
- package/theme-chalk/common/var.scss +1 -1
- package/theme-chalk/input/input.scss +424 -578
- package/theme-chalk/input/input.scss--bak +578 -0
- package/theme-chalk/select/index.scss +272 -247
- package/theme-chalk/select/index.scss--bak +247 -0
- package/theme-chalk/select/option-group.scss +2 -2
- package/theme-chalk/select/option.scss +2 -2
- package/theme-chalk/select/select-dropdown.scss +2 -2
- package/theme-chalk/tag.scss +181 -203
- package/theme-chalk/tag.scss--bak +203 -0
|
@@ -1,374 +1,88 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
3
|
-
var _excluded = ["filterable", "clearable", "error", "warning", "multiple", "collapseTags", "maxCollapseTags", "collapseTagsTooltip", "tagType", "tagEffect", "showArrow", "collapseTips", "filterMethod", "onChange", "allowCreate", "onEnter", "afterLeave", "prepend", "append", "onLoadSuccess", "onVisibleChange", "onRemoveTag", "onClear"];
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23;
|
|
4
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
6
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
7
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
6
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
7
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
8
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
-
function
|
|
16
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
19
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
20
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
22
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
23
10
|
import classNames from 'classnames';
|
|
24
|
-
import
|
|
25
|
-
import find from 'lodash/find';
|
|
26
|
-
import max from 'lodash/max';
|
|
27
|
-
import min from 'lodash/min';
|
|
28
|
-
import omit from 'lodash/omit';
|
|
29
|
-
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
30
|
-
import { useTranslation } from 'react-i18next';
|
|
31
|
-
import { useConfigProvider } from "../ConfigProvider/ConfigProviderContext";
|
|
11
|
+
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
32
12
|
import Icon from "../Icon/Icon";
|
|
33
|
-
import Input from "../Input/Input";
|
|
34
13
|
import Popper from "../Popper/Popper";
|
|
35
|
-
import
|
|
14
|
+
import Tag from "../Tag/Tag";
|
|
36
15
|
import Tooltip from "../Tooltip/Tooltip";
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
16
|
+
import { isEmpty, isNotEmpty } from "../Util";
|
|
17
|
+
import { useCalcInputWidth } from "../hooks/useCalcInputWidth";
|
|
39
18
|
import SelectDropdown from "./SelectDropdown";
|
|
19
|
+
import useSelect from "./useSelect";
|
|
40
20
|
var SelectCore = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
loadingText: /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Icon, {
|
|
56
|
-
prefix: "fas",
|
|
57
|
-
name: "spinner",
|
|
58
|
-
spin: true
|
|
59
|
-
}), " ", t('el.select.loading', {
|
|
60
|
-
lng: locale
|
|
61
|
-
})),
|
|
62
|
-
showArrow: true,
|
|
63
|
-
clearable: true,
|
|
64
|
-
filterable: false,
|
|
65
|
-
error: false,
|
|
66
|
-
required: false,
|
|
67
|
-
disabled: false,
|
|
68
|
-
maxWidth: 500,
|
|
69
|
-
collapseTagsTooltip: true,
|
|
70
|
-
maxCollapseTags: 1,
|
|
71
|
-
tagType: 'info',
|
|
72
|
-
tagEffect: 'light'
|
|
73
|
-
}, props);
|
|
74
|
-
var _useClassNames = useClassNames('select'),
|
|
75
|
-
b = _useClassNames.b,
|
|
76
|
-
e = _useClassNames.e,
|
|
77
|
-
be = _useClassNames.be,
|
|
78
|
-
m = _useClassNames.m,
|
|
79
|
-
is = _useClassNames.is;
|
|
80
|
-
// 选择框容器div
|
|
81
|
-
var containerRef = useRef(null);
|
|
82
|
-
// 下拉选项容器div
|
|
83
|
-
var contentRef = useRef(null);
|
|
84
|
-
var wrapperRef = useRef(null);
|
|
85
|
-
var createInputRef = useRef(null);
|
|
86
|
-
var popperInstRef = useRef(null);
|
|
87
|
-
var selectDropdownRef = useRef(null);
|
|
88
|
-
var inputInstance = useRef(null);
|
|
89
|
-
var searchInstance = useRef(null);
|
|
90
|
-
var tagTooltipRef = useRef(null);
|
|
91
|
-
var _props = props,
|
|
21
|
+
var _props = useSelect(props);
|
|
22
|
+
var nsSelect = _props.nsSelect,
|
|
23
|
+
containerRef = _props.containerRef,
|
|
24
|
+
contentRef = _props.contentRef,
|
|
25
|
+
wrapperRef = _props.wrapperRef,
|
|
26
|
+
suffixWrapperRef = _props.suffixWrapperRef,
|
|
27
|
+
popperInstRef = _props.popperInstRef,
|
|
28
|
+
selectDropdownRef = _props.selectDropdownRef,
|
|
29
|
+
tagTooltipRef = _props.tagTooltipRef,
|
|
30
|
+
inputRef = _props.inputRef,
|
|
31
|
+
inputValue = _props.inputValue,
|
|
32
|
+
setInputHovering = _props.setInputHovering,
|
|
33
|
+
setInputValue = _props.setInputValue,
|
|
34
|
+
setIsFocused = _props.setIsFocused,
|
|
92
35
|
filterable = _props.filterable,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
warning = _props.warning,
|
|
36
|
+
remote = _props.remote,
|
|
37
|
+
clearIcon = _props.clearIcon,
|
|
96
38
|
multiple = _props.multiple,
|
|
97
|
-
|
|
98
|
-
collapseTags = _props$collapseTags === void 0 ? false : _props$collapseTags,
|
|
39
|
+
collapseTags = _props.collapseTags,
|
|
99
40
|
maxCollapseTags = _props.maxCollapseTags,
|
|
100
41
|
collapseTagsTooltip = _props.collapseTagsTooltip,
|
|
101
42
|
tagType = _props.tagType,
|
|
102
43
|
tagEffect = _props.tagEffect,
|
|
103
44
|
showArrow = _props.showArrow,
|
|
104
45
|
collapseTips = _props.collapseTips,
|
|
105
|
-
filterMethod = _props.filterMethod,
|
|
106
|
-
onChange = _props.onChange,
|
|
107
46
|
allowCreate = _props.allowCreate,
|
|
108
|
-
onEnter = _props.onEnter,
|
|
109
|
-
afterLeave = _props.afterLeave,
|
|
110
47
|
prepend = _props.prepend,
|
|
111
48
|
append = _props.append,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return [];
|
|
147
|
-
}, [multiple, value]);
|
|
148
|
-
// 单选框显示文本
|
|
149
|
-
var _useState3 = useState(''),
|
|
150
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
151
|
-
label = _useState4[0],
|
|
152
|
-
setLabel = _useState4[1];
|
|
153
|
-
var _useState5 = useState(false),
|
|
154
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
155
|
-
visible = _useState6[0],
|
|
156
|
-
setVisible = _useState6[1];
|
|
157
|
-
var _useState7 = useState({}),
|
|
158
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
159
|
-
popperStyle = _useState8[0],
|
|
160
|
-
setPopperStyle = _useState8[1];
|
|
161
|
-
// 多选时input框高度
|
|
162
|
-
var _useState9 = useState(32),
|
|
163
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
164
|
-
inputHeight = _useState10[0],
|
|
165
|
-
setInputHeight = _useState10[1];
|
|
166
|
-
// 占位符
|
|
167
|
-
var placeholder = useMemo(function () {
|
|
168
|
-
return multiple && isNotEmpty(multiValue) || isNotEmpty(createItem) ? '' : props.placeholder;
|
|
169
|
-
}, [createItem, multiValue, multiple, props.placeholder]);
|
|
170
|
-
|
|
171
|
-
/** 获取所有的option组件 */
|
|
172
|
-
var getOptionInstance = useChildrenInstance('ElOption', 'ElOptionGroup');
|
|
173
|
-
var optionData = useMemo(function () {
|
|
174
|
-
if (props.children) {
|
|
175
|
-
var componentChildren = getOptionInstance(props.children);
|
|
176
|
-
return componentChildren.map(function (node) {
|
|
177
|
-
var _node$props$label, _node$props;
|
|
178
|
-
return {
|
|
179
|
-
label: (_node$props$label = (_node$props = node.props) === null || _node$props === void 0 ? void 0 : _node$props.label) !== null && _node$props$label !== void 0 ? _node$props$label : node.props.value,
|
|
180
|
-
value: node.props.value
|
|
181
|
-
};
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
return [];
|
|
185
|
-
}, [getOptionInstance, props.children]);
|
|
186
|
-
var multiLabel = useMemo(function () {
|
|
187
|
-
if (multiple) {
|
|
188
|
-
return multiValue.map(function (item) {
|
|
189
|
-
var _find$label, _find;
|
|
190
|
-
return (_find$label = (_find = find(optionData, {
|
|
191
|
-
value: item
|
|
192
|
-
})) === null || _find === void 0 ? void 0 : _find.label) !== null && _find$label !== void 0 ? _find$label : item;
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
return [];
|
|
196
|
-
}, [multiValue, multiple, optionData]);
|
|
197
|
-
|
|
198
|
-
/** 动态计算下拉框宽度 */
|
|
199
|
-
var handleEnter = useCallback(function (node) {
|
|
200
|
-
if (visible && contentRef.current && containerRef.current) {
|
|
201
|
-
var _selectDropdownRef$cu, _selectDropdownRef$cu2;
|
|
202
|
-
var rect = containerRef.current.getBoundingClientRect();
|
|
203
|
-
// const { width } = contentRef.current.getBoundingClientRect();
|
|
204
|
-
var options = Array.from(contentRef.current.querySelectorAll(".".concat(be('dropdown', 'item'), ">span")));
|
|
205
|
-
var maxWidth = (options.length > 0 ? max(options.map(function (item) {
|
|
206
|
-
var _item$offsetWidth;
|
|
207
|
-
return (_item$offsetWidth = item === null || item === void 0 ? void 0 : item.offsetWidth) !== null && _item$offsetWidth !== void 0 ? _item$offsetWidth : 0;
|
|
208
|
-
})) : 0) + 35;
|
|
209
|
-
if (maxWidth && maxWidth < rect.width) {
|
|
210
|
-
setPopperStyle(_objectSpread(_objectSpread({}, popperStyle), {}, {
|
|
211
|
-
width: rect.width
|
|
212
|
-
}));
|
|
213
|
-
} else {
|
|
214
|
-
setPopperStyle(_objectSpread(_objectSpread({}, popperStyle), {}, {
|
|
215
|
-
width: min([maxWidth, props.maxWidth])
|
|
216
|
-
}));
|
|
217
|
-
}
|
|
218
|
-
(_selectDropdownRef$cu = selectDropdownRef.current) === null || _selectDropdownRef$cu === void 0 || _selectDropdownRef$cu.scrollToSelected();
|
|
219
|
-
onEnter === null || onEnter === void 0 || onEnter(node);
|
|
220
|
-
(_selectDropdownRef$cu2 = selectDropdownRef.current) === null || _selectDropdownRef$cu2 === void 0 || _selectDropdownRef$cu2.onEnter();
|
|
221
|
-
}
|
|
222
|
-
}, [be, onEnter, popperStyle, props.maxWidth, visible]);
|
|
223
|
-
|
|
224
|
-
/** 关闭下拉框后清空搜索项 */
|
|
225
|
-
var handleAfterLeave = useCallback(function (node) {
|
|
226
|
-
var _selectDropdownRef$cu3;
|
|
227
|
-
(_selectDropdownRef$cu3 = selectDropdownRef.current) === null || _selectDropdownRef$cu3 === void 0 || _selectDropdownRef$cu3.clear();
|
|
228
|
-
afterLeave === null || afterLeave === void 0 || afterLeave(node);
|
|
229
|
-
}, [afterLeave]);
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* 展开/关闭下拉框
|
|
233
|
-
* @param e
|
|
234
|
-
* @returns
|
|
235
|
-
*/
|
|
236
|
-
var onClick = useCallback(function (event) {
|
|
237
|
-
event.preventDefault();
|
|
238
|
-
event === null || event === void 0 || event.stopPropagation();
|
|
239
|
-
if (disabled) {
|
|
240
|
-
setVisible(false);
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
setVisible(!visible);
|
|
244
|
-
}, [disabled, visible]);
|
|
245
|
-
|
|
246
|
-
/** 取消多选项 */
|
|
247
|
-
var onCloseTag = useCallback(function (item) {
|
|
248
|
-
var res = filter(multiValue, function (item1) {
|
|
249
|
-
return item1 !== item;
|
|
250
|
-
});
|
|
251
|
-
setValue(res);
|
|
252
|
-
onChange === null || onChange === void 0 || onChange(res, multiLabel);
|
|
253
|
-
onRemoveTag === null || onRemoveTag === void 0 || onRemoveTag(item);
|
|
254
|
-
setTimeout(function () {
|
|
255
|
-
if (tagTooltipRef.current) {
|
|
256
|
-
tagTooltipRef.current.updatePopper();
|
|
257
|
-
}
|
|
258
|
-
}, 50);
|
|
259
|
-
}, [multiLabel, multiValue, onChange, onRemoveTag, setValue]);
|
|
260
|
-
|
|
261
|
-
/** 重置值 */
|
|
262
|
-
var onClear = useCallback(function () {
|
|
263
|
-
var _selectDropdownRef$cu4;
|
|
264
|
-
setValue(multiple ? [] : '');
|
|
265
|
-
setLabel('');
|
|
266
|
-
(_selectDropdownRef$cu4 = selectDropdownRef.current) === null || _selectDropdownRef$cu4 === void 0 || _selectDropdownRef$cu4.hover('');
|
|
267
|
-
onChange === null || onChange === void 0 || onChange(multiple ? [] : '', multiple ? [] : '');
|
|
268
|
-
setCreateItem('');
|
|
269
|
-
onClearProp === null || onClearProp === void 0 || onClearProp();
|
|
270
|
-
}, [multiple, onChange, onClearProp, setValue]);
|
|
271
|
-
|
|
272
|
-
/** 选中项回调 */
|
|
273
|
-
var onChoose = useCallback(function (val, text, event) {
|
|
274
|
-
event.preventDefault();
|
|
275
|
-
if (isNotEmpty(val)) {
|
|
276
|
-
var result = val;
|
|
277
|
-
if (multiple) {
|
|
278
|
-
if (multiValue.includes(val)) {
|
|
279
|
-
result = filter(multiValue, function (item) {
|
|
280
|
-
return item !== val;
|
|
281
|
-
});
|
|
282
|
-
} else {
|
|
283
|
-
result = [].concat(_toConsumableArray(multiValue), [val]);
|
|
284
|
-
}
|
|
285
|
-
} else {
|
|
286
|
-
// 当选中项不是创建项时,清空创建项
|
|
287
|
-
if (val !== createItem) {
|
|
288
|
-
setCreateItem('');
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
setValue(result);
|
|
292
|
-
setLabel(multiple ? '' : text);
|
|
293
|
-
onChange === null || onChange === void 0 || onChange(result, multiple ? result.map(function (item) {
|
|
294
|
-
var _find$label2, _find2;
|
|
295
|
-
return (_find$label2 = (_find2 = find(optionData, {
|
|
296
|
-
value: item
|
|
297
|
-
})) === null || _find2 === void 0 ? void 0 : _find2.label) !== null && _find$label2 !== void 0 ? _find$label2 : item;
|
|
298
|
-
}) : text);
|
|
299
|
-
!multiple && onClick(event);
|
|
300
|
-
} else {
|
|
301
|
-
setVisible(false);
|
|
302
|
-
}
|
|
303
|
-
}, [multiple, setValue, onChange, multiValue, onClick, createItem, optionData]);
|
|
304
|
-
|
|
305
|
-
/** 监听加载状态,加载中时自动打开下拉 */
|
|
306
|
-
// useEffect(() => {
|
|
307
|
-
// setVisible(props.loading);
|
|
308
|
-
// popperInstRef.current?.update();
|
|
309
|
-
// }, [props.loading]);
|
|
310
|
-
|
|
311
|
-
// 打开后搜索框自动获取焦点
|
|
312
|
-
useEffect(function () {
|
|
313
|
-
if (visible && filterable && !allowCreate) {
|
|
314
|
-
var _searchInstance$curre;
|
|
315
|
-
(_searchInstance$curre = searchInstance.current) === null || _searchInstance$curre === void 0 || _searchInstance$curre.focus();
|
|
316
|
-
}
|
|
317
|
-
onVisibleChange === null || onVisibleChange === void 0 || onVisibleChange(visible);
|
|
318
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
319
|
-
}, [visible]);
|
|
320
|
-
|
|
321
|
-
/** 搜索时 */
|
|
322
|
-
useEffect(function () {
|
|
323
|
-
if (popperInstRef.current && popperInstRef.current.update) {
|
|
324
|
-
var _popperInstRef$curren;
|
|
325
|
-
(_popperInstRef$curren = popperInstRef.current) === null || _popperInstRef$curren === void 0 || _popperInstRef$curren.update();
|
|
326
|
-
}
|
|
327
|
-
}, [popperStyle]);
|
|
328
|
-
|
|
329
|
-
/** 多选框选择选项后,动态调整input框高度 */
|
|
330
|
-
useEffect(function () {
|
|
331
|
-
setTimeout(function () {
|
|
332
|
-
if (wrapperRef.current) {
|
|
333
|
-
var _wrapperRef$current;
|
|
334
|
-
var height = ((_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.clientHeight) + 4;
|
|
335
|
-
setInputHeight(height <= 32 ? 32 : height);
|
|
336
|
-
}
|
|
337
|
-
if (popperInstRef.current && popperInstRef.current.update) {
|
|
338
|
-
var _popperInstRef$curren2;
|
|
339
|
-
(_popperInstRef$curren2 = popperInstRef.current) === null || _popperInstRef$curren2 === void 0 || _popperInstRef$curren2.update();
|
|
340
|
-
}
|
|
341
|
-
}, 50);
|
|
342
|
-
}, [multiValue]);
|
|
343
|
-
|
|
344
|
-
/** 初次加载时反显选中文本 */
|
|
345
|
-
useEffect(function () {
|
|
346
|
-
var labels = (value instanceof Array ? value : [value]).map(function (item) {
|
|
347
|
-
var _find3;
|
|
348
|
-
return (_find3 = find(optionData, {
|
|
349
|
-
value: item
|
|
350
|
-
})) === null || _find3 === void 0 ? void 0 : _find3.label;
|
|
351
|
-
}).filter(function (item) {
|
|
352
|
-
return !!item;
|
|
353
|
-
});
|
|
354
|
-
if (labels.length > 0) {
|
|
355
|
-
setLabel(multiple ? '' : labels.join(','));
|
|
356
|
-
} else {
|
|
357
|
-
if (isNotEmpty(value)) {
|
|
358
|
-
setLabel(value instanceof Array ? value.join(',') : value + '');
|
|
359
|
-
} else {
|
|
360
|
-
setLabel('');
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
onLoadSuccess === null || onLoadSuccess === void 0 || onLoadSuccess(value, labels);
|
|
364
|
-
}, [multiple, onLoadSuccess, optionData, value]);
|
|
49
|
+
transitionProps = _props.transitionProps,
|
|
50
|
+
popperProps = _props.popperProps,
|
|
51
|
+
value = _props.value,
|
|
52
|
+
setValue = _props.setValue,
|
|
53
|
+
disabled = _props.disabled,
|
|
54
|
+
size = _props.size,
|
|
55
|
+
multiValue = _props.multiValue,
|
|
56
|
+
multiOptionData = _props.multiOptionData,
|
|
57
|
+
label = _props.label,
|
|
58
|
+
visible = _props.visible,
|
|
59
|
+
setVisible = _props.setVisible,
|
|
60
|
+
popperStyle = _props.popperStyle,
|
|
61
|
+
placeholder = _props.placeholder,
|
|
62
|
+
shouldShowPlaceholder = _props.shouldShowPlaceholder,
|
|
63
|
+
handleEnter = _props.handleEnter,
|
|
64
|
+
handleAfterLeave = _props.handleAfterLeave,
|
|
65
|
+
toggleMenu = _props.toggleMenu,
|
|
66
|
+
onCloseTag = _props.onCloseTag,
|
|
67
|
+
onClear = _props.onClear,
|
|
68
|
+
onChoose = _props.onChoose,
|
|
69
|
+
labelFormat = _props.labelFormat,
|
|
70
|
+
iconComponent = _props.iconComponent,
|
|
71
|
+
iconReverse = _props.iconReverse,
|
|
72
|
+
handleCompositionStart = _props.handleCompositionStart,
|
|
73
|
+
handleCompositionUpdate = _props.handleCompositionUpdate,
|
|
74
|
+
handleCompositionEnd = _props.handleCompositionEnd,
|
|
75
|
+
tag = _props.tag;
|
|
76
|
+
var b = nsSelect.b,
|
|
77
|
+
e = nsSelect.e,
|
|
78
|
+
m = nsSelect.m,
|
|
79
|
+
is = nsSelect.is;
|
|
80
|
+
var _useCalcInputWidth = useCalcInputWidth(),
|
|
81
|
+
calculatorRef = _useCalcInputWidth.calculatorRef,
|
|
82
|
+
inputStyle = _useCalcInputWidth.inputStyle;
|
|
365
83
|
useImperativeHandle(ref, function () {
|
|
366
84
|
return {
|
|
367
85
|
popperInstRef: popperInstRef,
|
|
368
|
-
selectedLabel: label,
|
|
369
|
-
setLabel: setLabel,
|
|
370
|
-
inputInstance: inputInstance,
|
|
371
|
-
searchInstance: searchInstance,
|
|
372
86
|
getValue: function getValue() {
|
|
373
87
|
return value;
|
|
374
88
|
},
|
|
@@ -383,145 +97,148 @@ var SelectCore = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
383
97
|
disabled: disabled
|
|
384
98
|
}), m(_defineProperty({}, size, size)), props.className),
|
|
385
99
|
style: append || prepend ? {} : props.style,
|
|
386
|
-
ref: containerRef
|
|
387
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
388
|
-
className: e(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["trigger"])))
|
|
389
|
-
}, multiple && /*#__PURE__*/React.createElement("div", {
|
|
390
|
-
className: e(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["tags"]))),
|
|
100
|
+
ref: containerRef,
|
|
391
101
|
onMouseEnter: function onMouseEnter() {
|
|
392
|
-
|
|
393
|
-
return (_inputInstance$curren = inputInstance.current) === null || _inputInstance$curren === void 0 ? void 0 : _inputInstance$curren.showClear(multiple ? multiValue.join(',') : createItem || label);
|
|
102
|
+
return setInputHovering(true);
|
|
394
103
|
},
|
|
395
104
|
onMouseLeave: function onMouseLeave() {
|
|
396
|
-
|
|
397
|
-
return (_inputInstance$curren2 = inputInstance.current) === null || _inputInstance$curren2 === void 0 ? void 0 : _inputInstance$curren2.hideClear();
|
|
105
|
+
return setInputHovering(false);
|
|
398
106
|
}
|
|
399
107
|
}, /*#__PURE__*/React.createElement("div", {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
108
|
+
ref: wrapperRef,
|
|
109
|
+
className: classNames(e(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["wrapper"]))), is({
|
|
110
|
+
disabled: disabled,
|
|
111
|
+
filterable: filterable
|
|
112
|
+
})),
|
|
113
|
+
style: props.style,
|
|
114
|
+
onClick: toggleMenu
|
|
115
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
116
|
+
className: classNames(e(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["selection"]))), is({
|
|
117
|
+
near: multiple && multiValue.length > 0
|
|
118
|
+
}))
|
|
119
|
+
}, multiple && (tag ? tag({
|
|
120
|
+
data: multiOptionData,
|
|
121
|
+
selectDisabled: disabled,
|
|
122
|
+
deleteTag: onCloseTag
|
|
123
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null, (collapseTags ? multiOptionData.slice(0, maxCollapseTags) : multiOptionData).map(function (item, i) {
|
|
124
|
+
var _item$label;
|
|
125
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
126
|
+
key: "".concat(item.value, "_").concat(i),
|
|
127
|
+
className: e(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["selected-item"])))
|
|
128
|
+
}, /*#__PURE__*/React.createElement(Tag, {
|
|
405
129
|
type: tagType,
|
|
406
|
-
key: multiValue[i],
|
|
407
130
|
closable: !disabled,
|
|
408
131
|
effect: tagEffect,
|
|
409
|
-
onClick:
|
|
410
|
-
onClose: function onClose() {
|
|
411
|
-
return onCloseTag(
|
|
132
|
+
onClick: toggleMenu,
|
|
133
|
+
onClose: function onClose(event) {
|
|
134
|
+
return onCloseTag(event, item);
|
|
412
135
|
},
|
|
413
136
|
disableTransitions: true
|
|
414
|
-
}, item);
|
|
137
|
+
}, isNotEmpty(item.value) && typeof item.value === 'string' && labelFormat ? labelFormat === null || labelFormat === void 0 ? void 0 : labelFormat(-1, item.value, item.label) : (_item$label = item.label) !== null && _item$label !== void 0 ? _item$label : item.value));
|
|
415
138
|
}), collapseTags && (multiValue === null || multiValue === void 0 ? void 0 : multiValue.length) > maxCollapseTags && /*#__PURE__*/React.createElement(Tooltip, {
|
|
416
139
|
ref: tagTooltipRef,
|
|
417
140
|
popperClass: e(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["tooltip"]))),
|
|
418
141
|
placement: "top",
|
|
419
142
|
disabled: !collapseTagsTooltip,
|
|
420
|
-
content: /*#__PURE__*/React.createElement(
|
|
421
|
-
|
|
422
|
-
|
|
143
|
+
content: /*#__PURE__*/React.createElement("div", {
|
|
144
|
+
className: e(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["selection"])))
|
|
145
|
+
}, multiOptionData.slice(maxCollapseTags, multiOptionData.length).map(function (item, i) {
|
|
146
|
+
var _item$label2;
|
|
147
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
148
|
+
key: "".concat(item.value, "_").concat(i),
|
|
149
|
+
className: e(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["selected-item"])))
|
|
150
|
+
}, /*#__PURE__*/React.createElement(Tag, {
|
|
423
151
|
type: tagType,
|
|
424
152
|
disableTransitions: true,
|
|
425
153
|
closable: !disabled,
|
|
426
154
|
effect: tagEffect,
|
|
427
|
-
onClick:
|
|
428
|
-
onClose: function onClose() {
|
|
429
|
-
return onCloseTag(
|
|
155
|
+
onClick: toggleMenu,
|
|
156
|
+
onClose: function onClose(evt) {
|
|
157
|
+
return onCloseTag(evt, item);
|
|
430
158
|
}
|
|
431
|
-
}, item);
|
|
159
|
+
}, isNotEmpty(item.value) && typeof item.value === 'string' && labelFormat ? labelFormat === null || labelFormat === void 0 ? void 0 : labelFormat(-1, item.value, item.label) : (_item$label2 = item.label) !== null && _item$label2 !== void 0 ? _item$label2 : item.value));
|
|
432
160
|
})),
|
|
433
161
|
effect: "light",
|
|
434
162
|
enterable: true
|
|
163
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
className: e(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["selected-item"])))
|
|
435
165
|
}, /*#__PURE__*/React.createElement(Tag, {
|
|
436
166
|
type: tagType,
|
|
437
|
-
onClick:
|
|
167
|
+
onClick: toggleMenu,
|
|
438
168
|
disableTransitions: true,
|
|
439
169
|
effect: tagEffect
|
|
440
|
-
}, collapseTips ? collapseTips(
|
|
170
|
+
}, collapseTips ? collapseTips(multiOptionData.length - maxCollapseTags, multiOptionData.length) : "+ ".concat(multiOptionData.length - maxCollapseTags)))))), /*#__PURE__*/React.createElement("div", {
|
|
171
|
+
className: classNames(e(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["selected-item"]))), e(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["input-wrapper"]))), is({
|
|
172
|
+
hidden: !filterable
|
|
173
|
+
}))
|
|
174
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
175
|
+
ref: inputRef,
|
|
176
|
+
value: inputValue,
|
|
441
177
|
type: "text",
|
|
442
|
-
className: e(
|
|
443
|
-
style:
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
},
|
|
453
|
-
onInput: function onInput(event) {
|
|
178
|
+
className: classNames(e(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["input"]))), is(size)),
|
|
179
|
+
style: inputStyle,
|
|
180
|
+
disabled: disabled,
|
|
181
|
+
readOnly: !filterable,
|
|
182
|
+
onClick: toggleMenu,
|
|
183
|
+
onCompositionStart: handleCompositionStart,
|
|
184
|
+
onCompositionUpdate: handleCompositionUpdate,
|
|
185
|
+
onCompositionEnd: handleCompositionEnd,
|
|
186
|
+
onChange: function onChange(event) {
|
|
187
|
+
setInputValue(event.target.value);
|
|
454
188
|
setVisible(true);
|
|
455
|
-
setCreateItem(event.target.value);
|
|
456
|
-
if (popperInstRef.current && popperInstRef.current.update) {
|
|
457
|
-
var _popperInstRef$curren3;
|
|
458
|
-
(_popperInstRef$curren3 = popperInstRef.current) === null || _popperInstRef$curren3 === void 0 || _popperInstRef$curren3.update();
|
|
459
|
-
}
|
|
460
189
|
},
|
|
461
190
|
onKeyDown: function onKeyDown(event) {
|
|
462
191
|
if (event.key === 'Enter') {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
192
|
+
if (allowCreate && isNotEmpty(inputValue)) {
|
|
193
|
+
onChoose(inputValue, {
|
|
194
|
+
value: inputValue,
|
|
195
|
+
label: inputValue
|
|
196
|
+
}, event);
|
|
467
197
|
}
|
|
468
198
|
}
|
|
469
199
|
},
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
setCreateItem('');
|
|
473
|
-
if (createInputRef.current) {
|
|
474
|
-
createInputRef.current.value = '';
|
|
475
|
-
}
|
|
476
|
-
}, 200);
|
|
477
|
-
}
|
|
478
|
-
})), /*#__PURE__*/React.createElement(Input, _extends({
|
|
479
|
-
ref: inputInstance,
|
|
480
|
-
value: multiple ? multiValue.join(',') : createItem || label,
|
|
481
|
-
hiddenValue: multiple,
|
|
482
|
-
placeholder: placeholder,
|
|
483
|
-
readOnly: !allowCreate,
|
|
484
|
-
clearable: clearable && !disabled,
|
|
485
|
-
disabled: disabled,
|
|
486
|
-
onClick: onClick,
|
|
487
|
-
onClear: onClear,
|
|
488
|
-
plain: props.plain,
|
|
489
|
-
className: classNames(is({
|
|
490
|
-
active: visible
|
|
491
|
-
})),
|
|
492
|
-
size: size,
|
|
493
|
-
onChange: function onChange(val) {
|
|
494
|
-
setVisible(true);
|
|
495
|
-
setCreateItem(val + '');
|
|
496
|
-
},
|
|
497
|
-
onKeyDown: function onKeyDown(event) {
|
|
498
|
-
if (event.key === 'Enter') {
|
|
499
|
-
onChoose(createItem, createItem, event);
|
|
500
|
-
}
|
|
200
|
+
onFocus: function onFocus() {
|
|
201
|
+
return setIsFocused(true);
|
|
501
202
|
},
|
|
502
203
|
onBlur: function onBlur() {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
204
|
+
return setIsFocused(false);
|
|
205
|
+
}
|
|
206
|
+
// error={error}
|
|
207
|
+
// warning={warning}
|
|
208
|
+
// style={multiple ? { height: inputHeight } : {}}
|
|
209
|
+
// suffix={<Icon prefix="fal" name="angle-down" rotate={visible ? 180 : null} onClick={toggleMenu} />}
|
|
210
|
+
}), filterable ? /*#__PURE__*/React.createElement("span", {
|
|
211
|
+
ref: calculatorRef,
|
|
212
|
+
"aria-hidden": "true",
|
|
213
|
+
className: e(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["input-calculator"])))
|
|
214
|
+
}, inputValue) : null), shouldShowPlaceholder && /*#__PURE__*/React.createElement("div", {
|
|
215
|
+
className: classNames(e(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["selected-item"]))), e(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["placeholder"]))), is({
|
|
216
|
+
transparent: isEmpty(label) || visible && !inputValue
|
|
217
|
+
}))
|
|
218
|
+
}, isNotEmpty(value) && typeof value === 'string' && labelFormat ? labelFormat === null || labelFormat === void 0 ? void 0 : labelFormat(-1, value, placeholder) : /*#__PURE__*/React.createElement("span", null, placeholder))), /*#__PURE__*/React.createElement("div", {
|
|
219
|
+
ref: suffixWrapperRef,
|
|
220
|
+
className: classNames(e(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["suffix"]))), is(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["hidden-clear"]))))
|
|
221
|
+
}, iconComponent ? /*#__PURE__*/React.createElement(Icon, {
|
|
222
|
+
name: iconComponent,
|
|
223
|
+
className: classNames(e(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["caret"]))), e(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["icon"]))), e(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["arrow"]))), iconReverse),
|
|
224
|
+
onClick: toggleMenu
|
|
225
|
+
}) : null, clearIcon ? /*#__PURE__*/React.createElement(Icon, {
|
|
226
|
+
prefix: "fal",
|
|
227
|
+
name: clearIcon,
|
|
228
|
+
className: classNames(e(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["caret"]))), e(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["icon"]))), e(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["clear"])))),
|
|
229
|
+
onClick: onClear
|
|
230
|
+
}) : null)), /*#__PURE__*/React.createElement(Popper, _extends({
|
|
519
231
|
referenceElement: containerRef,
|
|
520
232
|
visible: visible,
|
|
233
|
+
popperClass: e(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["popper"]))),
|
|
521
234
|
popperInstRef: popperInstRef,
|
|
522
|
-
popperStyle: popperStyle,
|
|
235
|
+
popperStyle: _objectSpread(_objectSpread({}, popperStyle), {}, {
|
|
236
|
+
visibility: filterable && remote && isEmpty(inputValue) ? 'hidden' : 'visible'
|
|
237
|
+
}),
|
|
523
238
|
onDestroy: function onDestroy() {
|
|
524
|
-
|
|
239
|
+
setVisible(false);
|
|
240
|
+
setInputValue('');
|
|
241
|
+
setIsFocused(false);
|
|
525
242
|
},
|
|
526
243
|
onEnter: handleEnter,
|
|
527
244
|
afterLeave: handleAfterLeave,
|
|
@@ -532,14 +249,14 @@ var SelectCore = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
532
249
|
}, transitionProps, popperProps), /*#__PURE__*/React.createElement(SelectDropdown, _extends({
|
|
533
250
|
ref: selectDropdownRef,
|
|
534
251
|
value: value,
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
setCreateItem: setCreateItem,
|
|
252
|
+
inputValue: inputValue,
|
|
253
|
+
setInputValue: setInputValue,
|
|
538
254
|
onChoose: onChoose,
|
|
539
255
|
contentRef: contentRef,
|
|
540
|
-
createInputRef: createInputRef,
|
|
541
256
|
popperInstRef: popperInstRef
|
|
542
|
-
},
|
|
257
|
+
}, _props, {
|
|
258
|
+
onClear: props.onClear
|
|
259
|
+
}), props.children)));
|
|
543
260
|
});
|
|
544
261
|
SelectCore.displayName = 'SelectCore';
|
|
545
262
|
export default SelectCore;
|