@ucloud-fe/react-components 1.5.15 → 1.5.16
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 +6 -0
- package/dist/main.min.js +1 -1
- package/lib/components/Select/Select.js +29 -29
- package/package.json +1 -1
|
@@ -75,8 +75,6 @@ var _zh_CN = _interopRequireDefault(require("./locale/zh_CN"));
|
|
|
75
75
|
|
|
76
76
|
var _Overflow = _interopRequireWildcard(require("./Overflow"));
|
|
77
77
|
|
|
78
|
-
var _this7 = void 0;
|
|
79
|
-
|
|
80
78
|
var _excluded = ["v1"],
|
|
81
79
|
_excluded2 = ["content"],
|
|
82
80
|
_excluded3 = ["content"],
|
|
@@ -84,6 +82,8 @@ var _excluded = ["v1"],
|
|
|
84
82
|
_excluded5 = ["items", "onClose", "disabled"],
|
|
85
83
|
_excluded6 = ["size", "value", "defaultValue", "onChange", "onVisibleChange", "disabled", "search", "multiple", "renderContent", "renderSelector", "placeholder", "locale", "options", "children", "emptyContent", "showSelectAll", "extra", "clearable", "customStyle", "popover", "popoverProps", "renderPopup", "virtualList", "block", "styleType"];
|
|
86
84
|
|
|
85
|
+
var _this = void 0;
|
|
86
|
+
|
|
87
87
|
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); }
|
|
88
88
|
|
|
89
89
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(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; }
|
|
@@ -111,8 +111,13 @@ var groupOptions = {
|
|
|
111
111
|
SubGroupComponent: _Group.default
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
+
var isValidKey = function isValidKey(v) {
|
|
115
|
+
(0, _newArrowCheck2.default)(this, _this);
|
|
116
|
+
return typeof v === 'string' || typeof v === 'number';
|
|
117
|
+
}.bind(void 0);
|
|
118
|
+
|
|
114
119
|
var groupChildrenAsDataSource = function groupChildrenAsDataSource(children) {
|
|
115
|
-
var
|
|
120
|
+
var _this2 = this;
|
|
116
121
|
|
|
117
122
|
var globalDisabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
118
123
|
|
|
@@ -133,9 +138,9 @@ var groupChildrenAsDataSource = function groupChildrenAsDataSource(children) {
|
|
|
133
138
|
var childrenMap = new Map();
|
|
134
139
|
|
|
135
140
|
var _group = function group(children, disabled, prefix) {
|
|
136
|
-
var
|
|
141
|
+
var _this3 = this;
|
|
137
142
|
|
|
138
|
-
(0, _newArrowCheck2.default)(this,
|
|
143
|
+
(0, _newArrowCheck2.default)(this, _this2);
|
|
139
144
|
var validKeys = [];
|
|
140
145
|
var disabledKeys = [];
|
|
141
146
|
|
|
@@ -144,7 +149,7 @@ var groupChildrenAsDataSource = function groupChildrenAsDataSource(children) {
|
|
|
144
149
|
var renderChildren = [];
|
|
145
150
|
|
|
146
151
|
_react.default.Children.forEach(children, function (child, i) {
|
|
147
|
-
(0, _newArrowCheck2.default)(this,
|
|
152
|
+
(0, _newArrowCheck2.default)(this, _this3);
|
|
148
153
|
var isFirst = i === 0;
|
|
149
154
|
var isLast = i === l - 1;
|
|
150
155
|
|
|
@@ -171,7 +176,7 @@ var groupChildrenAsDataSource = function groupChildrenAsDataSource(children) {
|
|
|
171
176
|
}
|
|
172
177
|
|
|
173
178
|
var display = Array.isArray(_visible) ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, _visible[0], /*#__PURE__*/_react.default.createElement(_Search.Highlight, null, _visible[1]), _visible[2]) : (_ref2 = _props.children) !== null && _ref2 !== void 0 ? _ref2 : _key;
|
|
174
|
-
renderChildren.push( /*#__PURE__*/_react.default.cloneElement(child, (_React$cloneElement = {}, (0, _defineProperty2.default)(_React$cloneElement, itemKeyName, _key), (0, _defineProperty2.default)(_React$cloneElement, "disabled", globalDisabled || isDisabled), (0, _defineProperty2.default)(_React$cloneElement, "isFirst", isFirst), (0, _defineProperty2.default)(_React$cloneElement, "isLast", isLast), (0, _defineProperty2.default)(_React$cloneElement, "key", _key), (0, _defineProperty2.default)(_React$cloneElement, "children", display), _React$cloneElement)));
|
|
179
|
+
renderChildren.push( /*#__PURE__*/_react.default.cloneElement(child, (_React$cloneElement = {}, (0, _defineProperty2.default)(_React$cloneElement, itemKeyName, _key), (0, _defineProperty2.default)(_React$cloneElement, "disabled", globalDisabled || isDisabled), (0, _defineProperty2.default)(_React$cloneElement, "isFirst", isFirst), (0, _defineProperty2.default)(_React$cloneElement, "isLast", isLast), (0, _defineProperty2.default)(_React$cloneElement, "key", isValidKey(_key) ? _key : child.key || "".concat(i)), (0, _defineProperty2.default)(_React$cloneElement, "children", display), _React$cloneElement)));
|
|
175
180
|
childrenMap.set(_key, display);
|
|
176
181
|
} else {
|
|
177
182
|
childrenMap.set(_key, _props.children);
|
|
@@ -214,7 +219,7 @@ var groupChildrenAsDataSource = function groupChildrenAsDataSource(children) {
|
|
|
214
219
|
};
|
|
215
220
|
|
|
216
221
|
var groupOptionsAsDataSource = function groupOptionsAsDataSource(options) {
|
|
217
|
-
var
|
|
222
|
+
var _this4 = this;
|
|
218
223
|
|
|
219
224
|
var globalDisabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
220
225
|
|
|
@@ -224,11 +229,11 @@ var groupOptionsAsDataSource = function groupOptionsAsDataSource(options) {
|
|
|
224
229
|
itemKeyName: 'itemKey',
|
|
225
230
|
subGroupKeyName: 'subGroupKey',
|
|
226
231
|
ItemComponent: function ItemComponent() {
|
|
227
|
-
(0, _newArrowCheck2.default)(this,
|
|
232
|
+
(0, _newArrowCheck2.default)(this, _this4);
|
|
228
233
|
return null;
|
|
229
234
|
}.bind(this),
|
|
230
235
|
SubGroupComponent: function SubGroupComponent() {
|
|
231
|
-
(0, _newArrowCheck2.default)(this,
|
|
236
|
+
(0, _newArrowCheck2.default)(this, _this4);
|
|
232
237
|
return null;
|
|
233
238
|
}.bind(this)
|
|
234
239
|
},
|
|
@@ -244,13 +249,8 @@ var groupOptionsAsDataSource = function groupOptionsAsDataSource(options) {
|
|
|
244
249
|
var subGroupMap = new Map();
|
|
245
250
|
var childrenMap = new Map();
|
|
246
251
|
|
|
247
|
-
var isValidKey = function isValidKey(v) {
|
|
248
|
-
(0, _newArrowCheck2.default)(this, _this3);
|
|
249
|
-
return typeof v === 'string' || typeof v === 'number';
|
|
250
|
-
}.bind(this);
|
|
251
|
-
|
|
252
252
|
var group = function group(options) {
|
|
253
|
-
var
|
|
253
|
+
var _this5 = this;
|
|
254
254
|
|
|
255
255
|
var disabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
256
256
|
var prefixKey = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -258,7 +258,7 @@ var groupOptionsAsDataSource = function groupOptionsAsDataSource(options) {
|
|
|
258
258
|
var disabledKeys = [];
|
|
259
259
|
var renderChildren = [];
|
|
260
260
|
options.forEach(function (child, i) {
|
|
261
|
-
(0, _newArrowCheck2.default)(this,
|
|
261
|
+
(0, _newArrowCheck2.default)(this, _this5);
|
|
262
262
|
var subChildren = child[subGroupName];
|
|
263
263
|
|
|
264
264
|
if (subChildren) {
|
|
@@ -357,7 +357,7 @@ var CustomPopup = /*#__PURE__*/_react.default.memo(function CustomPopup(props) {
|
|
|
357
357
|
});
|
|
358
358
|
|
|
359
359
|
var PopupV1 = /*#__PURE__*/_react.default.memo(function PopupV1(_ref9) {
|
|
360
|
-
var
|
|
360
|
+
var _this6 = this;
|
|
361
361
|
|
|
362
362
|
var extra = _ref9.extra,
|
|
363
363
|
_ref9$customStyle = _ref9.customStyle,
|
|
@@ -378,7 +378,7 @@ var PopupV1 = /*#__PURE__*/_react.default.memo(function PopupV1(_ref9) {
|
|
|
378
378
|
setSearchValue = _ref9.setSearchValue,
|
|
379
379
|
virtualList = _ref9.virtualList;
|
|
380
380
|
var handleChange = (0, _react.useCallback)(function (value) {
|
|
381
|
-
(0, _newArrowCheck2.default)(this,
|
|
381
|
+
(0, _newArrowCheck2.default)(this, _this6);
|
|
382
382
|
|
|
383
383
|
if (!multiple) {
|
|
384
384
|
handleVisibleChange(false);
|
|
@@ -388,11 +388,11 @@ var PopupV1 = /*#__PURE__*/_react.default.memo(function PopupV1(_ref9) {
|
|
|
388
388
|
}
|
|
389
389
|
}.bind(this), [multiple, onChange, handleVisibleChange]);
|
|
390
390
|
var handleSearchInput = (0, _react.useCallback)(function (e) {
|
|
391
|
-
(0, _newArrowCheck2.default)(this,
|
|
391
|
+
(0, _newArrowCheck2.default)(this, _this6);
|
|
392
392
|
setSearchValue(e.target.value);
|
|
393
393
|
}.bind(this), [setSearchValue]);
|
|
394
394
|
var finalExtra = (0, _react.useMemo)(function () {
|
|
395
|
-
(0, _newArrowCheck2.default)(this,
|
|
395
|
+
(0, _newArrowCheck2.default)(this, _this6);
|
|
396
396
|
|
|
397
397
|
if (typeof extra === 'function') {
|
|
398
398
|
return /*#__PURE__*/_react.default.createElement(_Extra.default, null, extra(hidePopup));
|
|
@@ -420,7 +420,7 @@ var PopupV1 = /*#__PURE__*/_react.default.memo(function PopupV1(_ref9) {
|
|
|
420
420
|
}
|
|
421
421
|
|
|
422
422
|
var emptyContent = (0, _react.useMemo)(function () {
|
|
423
|
-
(0, _newArrowCheck2.default)(this,
|
|
423
|
+
(0, _newArrowCheck2.default)(this, _this6);
|
|
424
424
|
return _emptyContent || /*#__PURE__*/_react.default.createElement(_style2.EmptyContentWrapper, null, locale.emptyTip);
|
|
425
425
|
}.bind(this), [_emptyContent, locale]);
|
|
426
426
|
return /*#__PURE__*/_react.default.createElement(_style2.MenuWrap, {
|
|
@@ -450,7 +450,7 @@ var PopupV1 = /*#__PURE__*/_react.default.memo(function PopupV1(_ref9) {
|
|
|
450
450
|
});
|
|
451
451
|
|
|
452
452
|
var PopupV2 = /*#__PURE__*/_react.default.memo(function PopupV2(_ref11) {
|
|
453
|
-
var
|
|
453
|
+
var _this7 = this,
|
|
454
454
|
_dataSource$;
|
|
455
455
|
|
|
456
456
|
var extra = _ref11.extra,
|
|
@@ -471,7 +471,7 @@ var PopupV2 = /*#__PURE__*/_react.default.memo(function PopupV2(_ref11) {
|
|
|
471
471
|
searchValue = _ref11.searchValue;
|
|
472
472
|
var menuRef = (0, _react.useRef)(null);
|
|
473
473
|
var handleChange = (0, _react.useCallback)(function (value) {
|
|
474
|
-
(0, _newArrowCheck2.default)(this,
|
|
474
|
+
(0, _newArrowCheck2.default)(this, _this7);
|
|
475
475
|
|
|
476
476
|
if (!multiple) {
|
|
477
477
|
handleVisibleChange(false);
|
|
@@ -481,17 +481,17 @@ var PopupV2 = /*#__PURE__*/_react.default.memo(function PopupV2(_ref11) {
|
|
|
481
481
|
}
|
|
482
482
|
}.bind(this), [multiple, onChange, handleVisibleChange]);
|
|
483
483
|
var handleSelectAll = (0, _react.useCallback)(function () {
|
|
484
|
-
(0, _newArrowCheck2.default)(this,
|
|
484
|
+
(0, _newArrowCheck2.default)(this, _this7);
|
|
485
485
|
var validKeys = dataSource[0];
|
|
486
486
|
var newValue = Array.from(new Set([].concat((0, _toConsumableArray2.default)(value || []), (0, _toConsumableArray2.default)(validKeys))));
|
|
487
487
|
onChange(newValue);
|
|
488
488
|
}.bind(this), [dataSource, onChange, value]);
|
|
489
489
|
var emptyContent = (0, _react.useMemo)(function () {
|
|
490
|
-
(0, _newArrowCheck2.default)(this,
|
|
490
|
+
(0, _newArrowCheck2.default)(this, _this7);
|
|
491
491
|
return _emptyContent || /*#__PURE__*/_react.default.createElement(_style2.EmptyContentWrapper, null, locale.emptyTip);
|
|
492
492
|
}.bind(this), [_emptyContent, locale]);
|
|
493
493
|
var finalExtra = (0, _react.useMemo)(function () {
|
|
494
|
-
(0, _newArrowCheck2.default)(this,
|
|
494
|
+
(0, _newArrowCheck2.default)(this, _this7);
|
|
495
495
|
|
|
496
496
|
if (typeof extra === 'function') {
|
|
497
497
|
return /*#__PURE__*/_react.default.createElement(_Extra.default, null, extra(hidePopup));
|
|
@@ -599,7 +599,7 @@ var Selector = /*#__PURE__*/_react.default.memo(function Selector(_ref13) {
|
|
|
599
599
|
var useOldContent = function useOldContent(_ref14) {
|
|
600
600
|
var _this8 = this;
|
|
601
601
|
|
|
602
|
-
(0, _newArrowCheck2.default)(this,
|
|
602
|
+
(0, _newArrowCheck2.default)(this, _this);
|
|
603
603
|
var locale = _ref14.locale,
|
|
604
604
|
placeholder = _ref14.placeholder,
|
|
605
605
|
multiple = _ref14.multiple,
|
|
@@ -1172,7 +1172,7 @@ var Select = function Select(_ref19) {
|
|
|
1172
1172
|
_search3,
|
|
1173
1173
|
_this21 = this;
|
|
1174
1174
|
|
|
1175
|
-
(0, _newArrowCheck2.default)(this,
|
|
1175
|
+
(0, _newArrowCheck2.default)(this, _this);
|
|
1176
1176
|
var _ref19$size = _ref19.size,
|
|
1177
1177
|
size = _ref19$size === void 0 ? 'md' : _ref19$size,
|
|
1178
1178
|
_value = _ref19.value,
|