@ucloud-fe/react-components 1.11.0 → 1.11.1

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.
@@ -36,5 +36,5 @@ interface AutoCompleteProps {
36
36
  /** @ignore */
37
37
  placeholder?: InputProps['placeholder'];
38
38
  }
39
- declare const _default: React.MemoExoticComponent<({ value: _value, defaultValue, onChange: _onChange, options, disabled, loading, prefix, block, handleSearch, popoverProps, onFocus, onBlur, style, className, status, placeholder }: AutoCompleteProps & Omit<InputProps, keyof AutoCompleteProps>) => JSX.Element>;
39
+ declare const _default: React.MemoExoticComponent<({ value: _value, defaultValue, onChange: _onChange, options, disabled, loading, prefix, block, handleSearch, popoverProps, onFocus, onBlur, style, className, status, placeholder, size }: AutoCompleteProps & Omit<InputProps, keyof AutoCompleteProps>) => JSX.Element>;
40
40
  export default _default;
@@ -62,7 +62,8 @@ var AutoComplete = function AutoComplete(_ref) {
62
62
  style = _ref.style,
63
63
  className = _ref.className,
64
64
  status = _ref.status,
65
- placeholder = _ref.placeholder;
65
+ placeholder = _ref.placeholder,
66
+ size = _ref.size;
66
67
 
67
68
  var _useUncontrolled = (0, _useUncontrolled3.default)(_value, defaultValue, _onChange),
68
69
  _useUncontrolled2 = (0, _slicedToArray2.default)(_useUncontrolled, 2),
@@ -139,6 +140,7 @@ var AutoComplete = function AutoComplete(_ref) {
139
140
  stretch: ['minWidth'],
140
141
  onVisibleChange: handleVisibleChange
141
142
  }), /*#__PURE__*/_react.default.createElement(_Input.default, {
143
+ size: size,
142
144
  value: value,
143
145
  onChange: onInputChange,
144
146
  onFocus: onFocus,
@@ -49,17 +49,30 @@ var messageContainerDom = document.createElement('div');
49
49
  var mainContainerDom = config.getContainer();
50
50
  var containerRef;
51
51
 
52
- _reactDom.default.render( /*#__PURE__*/_react.default.createElement(_MessageContainer.default, {
53
- ref: function (ref) {
54
- (0, _newArrowCheck2.default)(this, _this);
55
- return containerRef = ref;
56
- }.bind(void 0),
57
- id: "uc-fe-message-content-wrap",
58
- top: config.top
59
- }), messageContainerDom);
52
+ function MessageRefComponent() {
53
+ var _this2 = this;
54
+
55
+ var myRef = _react.default.useRef(null);
56
+
57
+ _react.default.useEffect(function () {
58
+ (0, _newArrowCheck2.default)(this, _this2);
59
+ containerRef = myRef.current;
60
+ }.bind(this), [myRef.current]);
61
+
62
+ return /*#__PURE__*/_react.default.createElement(_MessageContainer.default, {
63
+ ref: function (ref) {
64
+ (0, _newArrowCheck2.default)(this, _this2);
65
+ return myRef.current = ref;
66
+ }.bind(this),
67
+ id: "uc-fe-message-content-wrap",
68
+ top: config.top
69
+ });
70
+ }
60
71
 
61
72
  mainContainerDom.appendChild(messageContainerDom);
62
73
 
74
+ _reactDom.default.render( /*#__PURE__*/_react.default.createElement(MessageRefComponent, null), messageContainerDom);
75
+
63
76
  var ContextWrap = function ContextWrap(_ref) {
64
77
  (0, _newArrowCheck2.default)(this, _this);
65
78
  var children = _ref.children;
@@ -75,29 +88,35 @@ ContextWrap.propTypes = {
75
88
  };
76
89
 
77
90
  var popupMessage = function popupMessage(message) {
78
- var _this2 = this;
91
+ var _this3 = this;
79
92
 
80
93
  var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : config.duration;
81
94
  var onClose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
82
- (0, _newArrowCheck2.default)(this, _this2);
95
+ (0, _newArrowCheck2.default)(this, _this3);
83
96
  }.bind(this);
97
+
98
+ if (!containerRef) {
99
+ console.error("Error: containerRef is not ready , please check");
100
+ return;
101
+ }
102
+
84
103
  var messageUid = containerRef.appendMessage( /*#__PURE__*/_react.default.createElement(ContextWrap, null, message));
85
104
 
86
105
  var destroy = function destroy() {
87
- (0, _newArrowCheck2.default)(this, _this2);
106
+ (0, _newArrowCheck2.default)(this, _this3);
88
107
  containerRef.removeMessage(messageUid) && onClose();
89
108
  }.bind(this);
90
109
 
91
110
  if (duration) {
92
111
  setTimeout(function () {
93
- (0, _newArrowCheck2.default)(this, _this2);
112
+ (0, _newArrowCheck2.default)(this, _this3);
94
113
  destroy();
95
114
  }.bind(this), duration);
96
115
  }
97
116
 
98
117
  return {
99
118
  destory: function destory() {
100
- (0, _newArrowCheck2.default)(this, _this2);
119
+ (0, _newArrowCheck2.default)(this, _this3);
101
120
  console.error("Warning: wrong name of destory, please use destroy to instead");
102
121
  destroy();
103
122
  }.bind(this),
@@ -106,11 +125,11 @@ var popupMessage = function popupMessage(message) {
106
125
  };
107
126
 
108
127
  var showMessage = function showMessage(styleType, content) {
109
- var _this3 = this;
128
+ var _this4 = this;
110
129
 
111
130
  var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : config.duration;
112
131
  var onClose = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {
113
- (0, _newArrowCheck2.default)(this, _this3);
132
+ (0, _newArrowCheck2.default)(this, _this4);
114
133
  }.bind(this);
115
134
  var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
116
135
  var zIndex = option.zIndex,
@@ -131,7 +150,7 @@ var showMessage = function showMessage(styleType, content) {
131
150
  }
132
151
 
133
152
  var destroy = function destroy() {
134
- (0, _newArrowCheck2.default)(this, _this3);
153
+ (0, _newArrowCheck2.default)(this, _this4);
135
154
  }.bind(this);
136
155
 
137
156
  var message = /*#__PURE__*/_react.default.createElement(_Message.default, (0, _extends2.default)({
@@ -140,7 +159,7 @@ var showMessage = function showMessage(styleType, content) {
140
159
  className: className
141
160
  }, props, {
142
161
  onClose: function () {
143
- (0, _newArrowCheck2.default)(this, _this3);
162
+ (0, _newArrowCheck2.default)(this, _this4);
144
163
  return destroy();
145
164
  }.bind(this)
146
165
  }));
@@ -235,6 +235,7 @@ var ColumnConfigButton = /*#__PURE__*/function (_PureComponent2) {
235
235
  modalProps = _this$props3.modalProps,
236
236
  rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
237
237
  return /*#__PURE__*/_react.default.createElement(_style.ColumnConfigWrap, rest, /*#__PURE__*/_react.default.createElement(_style.ColumnConfigButtonWrap, {
238
+ shape: "square",
238
239
  icon: /*#__PURE__*/_react.default.createElement(_SvgIcon.default, {
239
240
  type: "cog",
240
241
  size: "14px"
@@ -472,7 +472,8 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
472
472
  return /*#__PURE__*/_react.default.createElement(_style.FilterIcon, {
473
473
  key: "icon",
474
474
  type: "filter",
475
- active: active
475
+ active: active,
476
+ disabled: rest.disabled
476
477
  });
477
478
  }.bind(this),
478
479
  multiple: multiple
@@ -1006,7 +1007,8 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1006
1007
  "data-row-key": rowKey,
1007
1008
  onMouseEnter: _this2.setDraggable,
1008
1009
  onMouseLeave: _this2.unsetDraggable,
1009
- className: _style.draggerCls
1010
+ className: _style.draggerCls,
1011
+ "data-testid": "draggable"
1010
1012
  }, /*#__PURE__*/_react.default.createElement(_SvgIcon.default, {
1011
1013
  type: "dragger",
1012
1014
  size: "16px"
@@ -1138,8 +1140,16 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1138
1140
  }.bind(this);
1139
1141
 
1140
1142
  _this2.onDragEnd = function (source) {
1143
+ var _this29 = this;
1144
+
1141
1145
  (0, _newArrowCheck2.default)(this, _this3);
1142
1146
 
1147
+ _this2.getTableDom().querySelectorAll('.uc-fe-table-row').forEach(function (row) {
1148
+ (0, _newArrowCheck2.default)(this, _this29);
1149
+ row.classList.remove(_style.dragOverDownCls);
1150
+ row.classList.remove(_style.dragOverUpCls);
1151
+ }.bind(this));
1152
+
1143
1153
  _this2.initDrag(source);
1144
1154
  }.bind(this);
1145
1155
 
@@ -1191,7 +1201,7 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1191
1201
  }.bind(this);
1192
1202
 
1193
1203
  _this2.renderSearchInfo = function (option) {
1194
- var _this29 = this;
1204
+ var _this30 = this;
1195
1205
 
1196
1206
  (0, _newArrowCheck2.default)(this, _this3);
1197
1207
  var filters = option.filters,
@@ -1201,15 +1211,15 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1201
1211
  var first = true;
1202
1212
 
1203
1213
  var renderLabel = function renderLabel(_ref5) {
1204
- var _this30 = this;
1214
+ var _this31 = this;
1205
1215
 
1206
- (0, _newArrowCheck2.default)(this, _this29);
1216
+ (0, _newArrowCheck2.default)(this, _this30);
1207
1217
  var value = _ref5.value,
1208
1218
  _ref5$column$filter = _ref5.column.filter,
1209
1219
  multiple = _ref5$column$filter.multiple,
1210
1220
  options = _ref5$column$filter.options;
1211
1221
  options = options.map(function (option) {
1212
- (0, _newArrowCheck2.default)(this, _this30);
1222
+ (0, _newArrowCheck2.default)(this, _this31);
1213
1223
  return !(0, _isObject2.default)(option) ? {
1214
1224
  value: option,
1215
1225
  label: option
@@ -1218,23 +1228,23 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1218
1228
 
1219
1229
  if (multiple) {
1220
1230
  var label = (0, _map2.default)(value, function (v) {
1221
- var _this31 = this;
1231
+ var _this32 = this;
1222
1232
 
1223
- (0, _newArrowCheck2.default)(this, _this30);
1233
+ (0, _newArrowCheck2.default)(this, _this31);
1224
1234
  var option = (0, _find2.default)(options, function (option) {
1225
- (0, _newArrowCheck2.default)(this, _this31);
1235
+ (0, _newArrowCheck2.default)(this, _this32);
1226
1236
  return v === option.value;
1227
1237
  }.bind(this));
1228
1238
  return option && option.label;
1229
1239
  }.bind(this));
1230
1240
  var _first = true;
1231
1241
  return (0, _map2.default)(label, function (_label) {
1232
- (0, _newArrowCheck2.default)(this, _this30);
1242
+ (0, _newArrowCheck2.default)(this, _this31);
1233
1243
  return _first ? [_first = false, _label] : [' | ', _label];
1234
1244
  }.bind(this));
1235
1245
  } else {
1236
1246
  var _option = (0, _find2.default)(options, function (option) {
1237
- (0, _newArrowCheck2.default)(this, _this30);
1247
+ (0, _newArrowCheck2.default)(this, _this31);
1238
1248
  return value === option.value;
1239
1249
  }.bind(this));
1240
1250
 
@@ -1250,7 +1260,7 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1250
1260
  closable: false,
1251
1261
  className: "".concat(_style.prefixCls, "-filter-notice")
1252
1262
  }, searchValue && /*#__PURE__*/_react.default.createElement("span", null, locale.search, locale.colon, searchValue, locale.semicolon), !(0, _isEmpty2.default)(filters) && /*#__PURE__*/_react.default.createElement("span", null, locale.filter, locale.colon, (0, _map2.default)(filters, function (filterInfo) {
1253
- (0, _newArrowCheck2.default)(this, _this29);
1263
+ (0, _newArrowCheck2.default)(this, _this30);
1254
1264
  return first ? [first = false, renderLabel(filterInfo)] : [', ', renderLabel(filterInfo)];
1255
1265
  }.bind(this)), locale.semicolon), /*#__PURE__*/_react.default.createElement("span", null, locale.searchResult, locale.colon, total, locale.items, locale.semicolon), /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("a", {
1256
1266
  className: "".concat(_style.prefixCls, "-reset-link"),
@@ -1403,7 +1413,7 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1403
1413
  (0, _createClass2.default)(Table, [{
1404
1414
  key: "render",
1405
1415
  value: function render() {
1406
- var _this32 = this;
1416
+ var _this33 = this;
1407
1417
 
1408
1418
  /* eslint-disable no-unused-vars */
1409
1419
  var _this$props = this.props,
@@ -1466,7 +1476,7 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1466
1476
 
1467
1477
  var columns = this.getColumns(dataSource, finalFilters);
1468
1478
  var defaultExpandAllRowsProps = !defaultExpandAllRows ? null : function () {
1469
- (0, _newArrowCheck2.default)(this, _this32);
1479
+ (0, _newArrowCheck2.default)(this, _this33);
1470
1480
  var _this$state$changedUn = this.state.changedUnExpandedRowKeys,
1471
1481
  changedUnExpandedRowKeys = _this$state$changedUn === void 0 ? {} : _this$state$changedUn;
1472
1482
  var expandedRowKeys = this.getExpandedRowKeys(dataSource, changedUnExpandedRowKeys);
@@ -1528,7 +1538,7 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1528
1538
  expandedRowRender: expandedRowRender,
1529
1539
  expandIconColumnIndex: expandIconColumnIndex === undefined ? columns[0] && columns[0].key === 'table_row_selection' ? 1 : 0 : expandIconColumnIndex,
1530
1540
  title: function () {
1531
- (0, _newArrowCheck2.default)(this, _this32);
1541
+ (0, _newArrowCheck2.default)(this, _this33);
1532
1542
  return this.renderTitle({
1533
1543
  filters: finalFilters,
1534
1544
  searchValue: searchValue,
@@ -1537,7 +1547,7 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1537
1547
  });
1538
1548
  }.bind(this),
1539
1549
  footer: function () {
1540
- (0, _newArrowCheck2.default)(this, _this32);
1550
+ (0, _newArrowCheck2.default)(this, _this33);
1541
1551
  return this.renderFooter({
1542
1552
  dataSource: _d,
1543
1553
  emptyContent: emptyContent,
@@ -1553,7 +1563,7 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1553
1563
  }, pagination, {
1554
1564
  className: "".concat(_style.prefixCls, "-pagination"),
1555
1565
  onChange: function (current, pageSize) {
1556
- (0, _newArrowCheck2.default)(this, _this32);
1566
+ (0, _newArrowCheck2.default)(this, _this33);
1557
1567
  this.setState({
1558
1568
  pagination: {
1559
1569
  current: current,
@@ -1563,7 +1573,7 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1563
1573
  pagination.onChange && pagination.onChange(current, pageSize);
1564
1574
  }.bind(this),
1565
1575
  onPageSizeChange: function (current, pageSize) {
1566
- (0, _newArrowCheck2.default)(this, _this32);
1576
+ (0, _newArrowCheck2.default)(this, _this33);
1567
1577
  this.setState({
1568
1578
  pagination: {
1569
1579
  current: current,
@@ -1573,7 +1583,7 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
1573
1583
  pagination.onPageSizeChange && pagination.onPageSizeChange(current, pageSize);
1574
1584
  }.bind(this),
1575
1585
  onAdvise: function (current, pageSize) {
1576
- (0, _newArrowCheck2.default)(this, _this32);
1586
+ (0, _newArrowCheck2.default)(this, _this33);
1577
1587
  this.setState({
1578
1588
  pagination: {
1579
1589
  current: current,