@douyinfe/semi-ui 2.19.0-alpha.2 → 2.19.0-alpha.3

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.
Files changed (49) hide show
  1. package/checkbox/checkbox.tsx +7 -7
  2. package/checkbox/checkboxGroup.tsx +2 -11
  3. package/dist/css/semi.css +16 -10
  4. package/dist/css/semi.min.css +1 -1
  5. package/dist/umd/semi-ui.js +141 -119
  6. package/dist/umd/semi-ui.js.map +1 -1
  7. package/dist/umd/semi-ui.min.js +1 -1
  8. package/dist/umd/semi-ui.min.js.map +1 -1
  9. package/form/baseForm.tsx +0 -1
  10. package/lib/cjs/checkbox/checkbox.js +8 -2
  11. package/lib/cjs/checkbox/checkboxGroup.js +8 -31
  12. package/lib/cjs/form/baseForm.d.ts +1 -1
  13. package/lib/cjs/form/baseForm.js +0 -1
  14. package/lib/cjs/form/field.d.ts +1 -1
  15. package/lib/cjs/popconfirm/index.d.ts +4 -2
  16. package/lib/cjs/popconfirm/index.js +49 -31
  17. package/lib/cjs/radio/radioGroup.js +7 -34
  18. package/lib/cjs/table/ColumnFilter.js +4 -2
  19. package/lib/cjs/table/ColumnSorter.d.ts +1 -0
  20. package/lib/cjs/table/ColumnSorter.js +9 -6
  21. package/lib/cjs/table/Table.js +11 -4
  22. package/lib/cjs/tabs/TabBar.js +5 -1
  23. package/lib/cjs/transfer/index.js +7 -2
  24. package/lib/cjs/typography/title.d.ts +1 -1
  25. package/lib/es/checkbox/checkbox.js +8 -2
  26. package/lib/es/checkbox/checkboxGroup.js +6 -27
  27. package/lib/es/form/baseForm.d.ts +1 -1
  28. package/lib/es/form/baseForm.js +0 -1
  29. package/lib/es/form/field.d.ts +1 -1
  30. package/lib/es/popconfirm/index.d.ts +4 -2
  31. package/lib/es/popconfirm/index.js +49 -31
  32. package/lib/es/radio/radioGroup.js +5 -30
  33. package/lib/es/table/ColumnFilter.js +4 -2
  34. package/lib/es/table/ColumnSorter.d.ts +1 -0
  35. package/lib/es/table/ColumnSorter.js +9 -6
  36. package/lib/es/table/Table.js +10 -4
  37. package/lib/es/tabs/TabBar.js +5 -1
  38. package/lib/es/transfer/index.js +7 -2
  39. package/lib/es/typography/title.d.ts +1 -1
  40. package/package.json +7 -7
  41. package/popconfirm/_story/popconfirm.stories.js +37 -1
  42. package/popconfirm/index.tsx +14 -6
  43. package/radio/radioGroup.tsx +4 -15
  44. package/table/ColumnFilter.tsx +2 -1
  45. package/table/ColumnSorter.tsx +16 -10
  46. package/table/Table.tsx +7 -4
  47. package/tabs/TabBar.tsx +7 -1
  48. package/transfer/index.tsx +7 -2
  49. package/webpack.config.js +3 -1
@@ -27,13 +27,15 @@ export interface PopconfirmProps extends PopoverProps {
27
27
  zIndex?: number;
28
28
  trigger?: Trigger;
29
29
  position?: Position;
30
- onCancel?: (e: React.MouseEvent) => void;
31
- onConfirm?: (e: React.MouseEvent) => void;
30
+ onCancel?: (e: React.MouseEvent) => Promise<any> | void;
31
+ onConfirm?: (e: React.MouseEvent) => Promise<any> | void;
32
32
  onVisibleChange?: (visible: boolean) => void;
33
33
  onClickOutSide?: (e: React.MouseEvent) => void;
34
34
  }
35
35
  export interface PopconfirmState {
36
36
  visible: boolean;
37
+ cancelLoading: boolean;
38
+ confirmLoading: boolean;
37
39
  }
38
40
  export default class Popconfirm extends BaseComponent<PopconfirmProps, PopconfirmState> {
39
41
  static contextType: React.Context<ContextValue>;
@@ -44,6 +44,8 @@ export default class Popconfirm extends BaseComponent {
44
44
  this.stopImmediatePropagation = e => e && e.nativeEvent && e.nativeEvent.stopImmediatePropagation();
45
45
 
46
46
  this.state = {
47
+ cancelLoading: false,
48
+ confirmLoading: false,
47
49
  visible: props.defaultVisible || false
48
50
  };
49
51
  this.foundation = new PopconfirmFoundation(this.adapter);
@@ -67,6 +69,12 @@ export default class Popconfirm extends BaseComponent {
67
69
  setVisible: visible => this.setState({
68
70
  visible
69
71
  }),
72
+ updateConfirmLoading: loading => this.setState({
73
+ confirmLoading: loading
74
+ }),
75
+ updateCancelLoading: loading => this.setState({
76
+ cancelLoading: loading
77
+ }),
70
78
  notifyConfirm: e => this.props.onConfirm(e),
71
79
  notifyCancel: e => this.props.onCancel(e),
72
80
  notifyVisibleChange: visible => this.props.onVisibleChange(visible),
@@ -83,15 +91,21 @@ export default class Popconfirm extends BaseComponent {
83
91
  cancelButtonProps,
84
92
  okButtonProps
85
93
  } = this.props;
94
+ const {
95
+ cancelLoading,
96
+ confirmLoading
97
+ } = this.state;
86
98
  return /*#__PURE__*/React.createElement(LocaleConsumer, {
87
99
  componentName: "Popconfirm"
88
100
  }, (locale, localeCode) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _Object$assign({
89
101
  type: cancelType,
90
- onClick: this.handleCancel
102
+ onClick: this.handleCancel,
103
+ loading: cancelLoading
91
104
  }, cancelButtonProps), cancelText || _get(locale, 'cancel')), /*#__PURE__*/React.createElement(Button, _Object$assign({
92
105
  type: okType,
93
106
  theme: "solid",
94
- onClick: this.handleConfirm
107
+ onClick: this.handleConfirm,
108
+ loading: confirmLoading
95
109
  }, okButtonProps), okText || _get(locale, 'confirm'))));
96
110
  }
97
111
 
@@ -113,35 +127,39 @@ export default class Popconfirm extends BaseComponent {
113
127
  });
114
128
  const showTitle = title !== null && typeof title !== 'undefined';
115
129
  const showContent = content !== null || typeof content !== 'undefined';
116
- return /*#__PURE__*/React.createElement("div", {
117
- className: popCardCls,
118
- onClick: this.stopImmediatePropagation,
119
- style: style
120
- }, /*#__PURE__*/React.createElement("div", {
121
- className: "".concat(prefixCls, "-inner")
122
- }, /*#__PURE__*/React.createElement("div", {
123
- className: "".concat(prefixCls, "-header")
124
- }, /*#__PURE__*/React.createElement("i", {
125
- className: "".concat(prefixCls, "-header-icon"),
126
- "x-semi-prop": "icon"
127
- }, /*#__PURE__*/React.isValidElement(icon) ? icon : null), /*#__PURE__*/React.createElement("div", {
128
- className: "".concat(prefixCls, "-header-body")
129
- }, showTitle ? /*#__PURE__*/React.createElement("div", {
130
- className: "".concat(prefixCls, "-header-title"),
131
- "x-semi-prop": "title"
132
- }, title) : null, showContent ? /*#__PURE__*/React.createElement("div", {
133
- className: "".concat(prefixCls, "-header-content"),
134
- "x-semi-prop": "content"
135
- }, content) : null), /*#__PURE__*/React.createElement(Button, {
136
- className: "".concat(prefixCls, "-btn-close"),
137
- icon: /*#__PURE__*/React.createElement(IconClose, null),
138
- size: "small",
139
- theme: 'borderless',
140
- type: cancelType,
141
- onClick: this.handleCancel
142
- })), /*#__PURE__*/React.createElement("div", {
143
- className: "".concat(prefixCls, "-footer")
144
- }, this.renderControls())));
130
+ return (
131
+ /*#__PURE__*/
132
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
133
+ React.createElement("div", {
134
+ className: popCardCls,
135
+ onClick: this.stopImmediatePropagation,
136
+ style: style
137
+ }, /*#__PURE__*/React.createElement("div", {
138
+ className: "".concat(prefixCls, "-inner")
139
+ }, /*#__PURE__*/React.createElement("div", {
140
+ className: "".concat(prefixCls, "-header")
141
+ }, /*#__PURE__*/React.createElement("i", {
142
+ className: "".concat(prefixCls, "-header-icon"),
143
+ "x-semi-prop": "icon"
144
+ }, /*#__PURE__*/React.isValidElement(icon) ? icon : null), /*#__PURE__*/React.createElement("div", {
145
+ className: "".concat(prefixCls, "-header-body")
146
+ }, showTitle ? /*#__PURE__*/React.createElement("div", {
147
+ className: "".concat(prefixCls, "-header-title"),
148
+ "x-semi-prop": "title"
149
+ }, title) : null, showContent ? /*#__PURE__*/React.createElement("div", {
150
+ className: "".concat(prefixCls, "-header-content"),
151
+ "x-semi-prop": "content"
152
+ }, content) : null), /*#__PURE__*/React.createElement(Button, {
153
+ className: "".concat(prefixCls, "-btn-close"),
154
+ icon: /*#__PURE__*/React.createElement(IconClose, null),
155
+ size: "small",
156
+ theme: 'borderless',
157
+ type: cancelType,
158
+ onClick: this.handleCancel
159
+ })), /*#__PURE__*/React.createElement("div", {
160
+ className: "".concat(prefixCls, "-footer")
161
+ }, this.renderControls())))
162
+ );
145
163
  }
146
164
 
147
165
  render() {
@@ -1,10 +1,7 @@
1
1
  import _noop from "lodash/noop";
2
- import _get from "lodash/get";
3
2
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
4
3
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
5
4
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
6
- import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
7
- import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
8
5
  import React from 'react';
9
6
  import PropTypes from 'prop-types';
10
7
  import classnames from 'classnames';
@@ -104,8 +101,7 @@ class RadioGroup extends BaseComponent {
104
101
  return /*#__PURE__*/React.createElement(Radio, {
105
102
  key: index,
106
103
  disabled: this.props.disabled,
107
- value: option,
108
- type: type
104
+ value: option
109
105
  }, option);
110
106
  } else {
111
107
  return /*#__PURE__*/React.createElement(Radio, {
@@ -114,37 +110,16 @@ class RadioGroup extends BaseComponent {
114
110
  value: option.value,
115
111
  extra: option.extra,
116
112
  className: option.className,
117
- style: option.style,
118
- type: type
113
+ style: option.style
119
114
  }, option.label);
120
115
  }
121
116
  });
122
117
  } else if (children) {
123
118
  var _context5;
124
119
 
125
- inner = _mapInstanceProperty(_context5 = React.Children).call(_context5, children, (itm, index) => {
126
- if ( /*#__PURE__*/React.isValidElement(itm)) {
127
- var _context6;
128
-
129
- const props = {
130
- key: index
131
- };
132
-
133
- const isRadioComp = _someInstanceProperty(_context6 = ['Radio', 'RadioWithGroup']).call(_context6, comp => {
134
- var _context7;
135
-
136
- return _includesInstanceProperty(_context7 = [_get(itm, 'type.displayName'), _get(itm, 'type.name')]).call(_context7, comp);
137
- });
138
-
139
- if (isRadioComp) {
140
- props.type = type;
141
- }
142
-
143
- return /*#__PURE__*/React.cloneElement(itm, props);
144
- } else {
145
- return null;
146
- }
147
- });
120
+ inner = _mapInstanceProperty(_context5 = React.Children).call(_context5, children, (itm, index) => /*#__PURE__*/React.isValidElement(itm) ? /*#__PURE__*/React.cloneElement(itm, {
121
+ key: index
122
+ }) : null);
148
123
  }
149
124
 
150
125
  return /*#__PURE__*/React.createElement("div", {
@@ -153,12 +153,14 @@ export default function ColumnFilter() {
153
153
  } else {
154
154
  iconElem = /*#__PURE__*/React.createElement("div", {
155
155
  className: finalCls
156
- }, /*#__PURE__*/React.createElement(IconFilter, {
156
+ }, '\u200b'
157
+ /* ZWSP(zero-width space) */
158
+ , /*#__PURE__*/React.createElement(IconFilter, {
157
159
  role: "button",
158
160
  "aria-label": "Filter data with this column",
159
161
  "aria-haspopup": "listbox",
160
162
  tabIndex: -1,
161
- size: "small"
163
+ size: "default"
162
164
  }));
163
165
  }
164
166
 
@@ -7,6 +7,7 @@ export interface ColumnSorterProps {
7
7
  onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
8
8
  prefixCls?: string;
9
9
  sortOrder?: SortOrder;
10
+ title?: React.ReactNode;
10
11
  }
11
12
  export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
12
13
  static propTypes: {
@@ -12,9 +12,10 @@ export default class ColumnSorter extends PureComponent {
12
12
  prefixCls,
13
13
  onClick,
14
14
  sortOrder,
15
- style
15
+ style,
16
+ title
16
17
  } = this.props;
17
- const iconBtnSize = 'small';
18
+ const iconBtnSize = 'default';
18
19
  const upCls = cls("".concat(prefixCls, "-column-sorter-up"), {
19
20
  on: sortOrder === strings.SORT_DIRECTIONS[0]
20
21
  });
@@ -33,11 +34,13 @@ export default class ColumnSorter extends PureComponent {
33
34
  role: 'button'
34
35
  }, ariaProps, {
35
36
  tabIndex: -1,
36
- style: style,
37
- className: "".concat(prefixCls, "-column-sorter"),
37
+ className: "".concat(prefixCls, "-column-sorter-wrapper"),
38
38
  onClick: onClick,
39
39
  onKeyPress: e => isEnterPress(e) && onClick(e)
40
- }), /*#__PURE__*/React.createElement("span", {
40
+ }), title, /*#__PURE__*/React.createElement("div", {
41
+ style: style,
42
+ className: "".concat(prefixCls, "-column-sorter")
43
+ }, /*#__PURE__*/React.createElement("span", {
41
44
  className: "".concat(upCls)
42
45
  }, /*#__PURE__*/React.createElement(IconCaretup, {
43
46
  size: iconBtnSize
@@ -45,7 +48,7 @@ export default class ColumnSorter extends PureComponent {
45
48
  className: "".concat(downCls)
46
49
  }, /*#__PURE__*/React.createElement(IconCaretdown, {
47
50
  size: iconBtnSize
48
- })));
51
+ }))));
49
52
  }
50
53
 
51
54
  }
@@ -494,15 +494,23 @@ class Table extends BaseComponent {
494
494
  const defaultSortOrder = _get(curQuery, 'defaultSortOrder', false);
495
495
 
496
496
  const sortOrder = _this.foundation.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
497
+ const TitleNode = typeof rawTitle !== 'function' && /*#__PURE__*/React.createElement(React.Fragment, {
498
+ key: strings.DEFAULT_KEY_COLUMN_TITLE
499
+ }, rawTitle);
497
500
 
498
501
  if (typeof column.sorter === 'function' || column.sorter === true) {
502
+ // In order to increase the click hot area of ​​sorting, when sorting is required & useFullRender is false,
503
+ // both the title and sorting areas are used as the click hot area for sorting。
499
504
  const sorter = /*#__PURE__*/React.createElement(ColumnSorter, {
500
505
  key: strings.DEFAULT_KEY_COLUMN_SORTER,
501
506
  sortOrder: sortOrder,
502
- onClick: e => _this.foundation.handleSort(column, e)
507
+ onClick: e => _this.foundation.handleSort(column, e),
508
+ title: TitleNode
503
509
  });
504
510
  useFullRender && (titleMap.sorter = sorter);
505
511
  titleArr.push(sorter);
512
+ } else {
513
+ titleArr.push(TitleNode);
506
514
  }
507
515
 
508
516
  const stateFilteredValue = _get(curQuery, 'filteredValue');
@@ -523,9 +531,7 @@ class Table extends BaseComponent {
523
531
  titleArr.push(filter);
524
532
  }
525
533
 
526
- const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : titleArr.unshift( /*#__PURE__*/React.createElement(React.Fragment, {
527
- key: strings.DEFAULT_KEY_COLUMN_TITLE
528
- }, rawTitle)) && titleArr;
534
+ const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : titleArr;
529
535
  column = _Object$assign(_Object$assign({}, column), {
530
536
  title: newTitle
531
537
  });
@@ -125,7 +125,11 @@ class TabBar extends React.Component {
125
125
  var _context5, _context6;
126
126
 
127
127
  if (_isEmpty(items)) {
128
- return null;
128
+ return /*#__PURE__*/React.createElement(Button, {
129
+ disabled: true,
130
+ icon: icon,
131
+ theme: "borderless"
132
+ });
129
133
  }
130
134
 
131
135
  const {
@@ -280,7 +280,8 @@ class Transfer extends BaseComponent {
280
280
  const noMatch = inSearchMode && searchResult.size === 0;
281
281
  const emptySearch = emptyContent.search ? emptyContent.search : locale.emptySearch;
282
282
  const emptyLeft = emptyContent.left ? emptyContent.left : locale.emptyLeft;
283
- const emptyCom = this.renderEmpty('left', inputValue ? emptySearch : emptyLeft);
283
+ const emptyDataCom = this.renderEmpty('left', emptyLeft);
284
+ const emptySearchCom = this.renderEmpty('left', emptySearch);
284
285
  const loadingCom = /*#__PURE__*/React.createElement(Spin, null);
285
286
  let content = null;
286
287
 
@@ -290,7 +291,11 @@ class Transfer extends BaseComponent {
290
291
  break;
291
292
 
292
293
  case noMatch:
293
- content = emptyCom;
294
+ content = emptySearchCom;
295
+ break;
296
+
297
+ case data.length === 0:
298
+ content = emptyDataCom;
294
299
  break;
295
300
 
296
301
  case type === strings.TYPE_TREE_TO_LIST:
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
37
37
  underline: PropTypes.Requireable<boolean>;
38
38
  strong: PropTypes.Requireable<boolean>;
39
39
  type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
40
- heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 5 | 6>;
40
+ heading: PropTypes.Requireable<4 | 2 | 1 | 3 | 5 | 6>;
41
41
  style: PropTypes.Requireable<object>;
42
42
  className: PropTypes.Requireable<string>;
43
43
  component: PropTypes.Requireable<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.19.0-alpha.2",
3
+ "version": "2.19.0-alpha.3",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -15,11 +15,11 @@
15
15
  "dependencies": {
16
16
  "@babel/runtime-corejs3": "^7.15.4",
17
17
  "@douyinfe/semi-animation": "2.12.0",
18
- "@douyinfe/semi-animation-react": "2.19.0-alpha.2",
19
- "@douyinfe/semi-foundation": "2.19.0-alpha.2",
20
- "@douyinfe/semi-icons": "2.19.0-alpha.2",
18
+ "@douyinfe/semi-animation-react": "2.19.0-alpha.3",
19
+ "@douyinfe/semi-foundation": "2.19.0-alpha.3",
20
+ "@douyinfe/semi-icons": "2.19.0-alpha.3",
21
21
  "@douyinfe/semi-illustrations": "2.15.0",
22
- "@douyinfe/semi-theme-default": "2.19.0-alpha.2",
22
+ "@douyinfe/semi-theme-default": "2.19.0-alpha.3",
23
23
  "async-validator": "^3.5.0",
24
24
  "classnames": "^2.2.6",
25
25
  "copy-text-to-clipboard": "^2.1.1",
@@ -66,13 +66,13 @@
66
66
  ],
67
67
  "author": "",
68
68
  "license": "MIT",
69
- "gitHead": "8f3924ea67e8b1df150c590927421b42f7325074",
69
+ "gitHead": "db52c2a32ffb9587992b72bf7114289a4759e790",
70
70
  "devDependencies": {
71
71
  "@babel/plugin-proposal-decorators": "^7.15.8",
72
72
  "@babel/plugin-transform-runtime": "^7.15.8",
73
73
  "@babel/preset-env": "^7.15.8",
74
74
  "@babel/preset-react": "^7.14.5",
75
- "@douyinfe/semi-scss-compile": "2.19.0-alpha.2",
75
+ "@douyinfe/semi-scss-compile": "2.19.0-alpha.3",
76
76
  "@storybook/addon-knobs": "^6.3.1",
77
77
  "@types/lodash": "^4.14.176",
78
78
  "@types/react": ">=16.0.0",
@@ -167,4 +167,40 @@ export const ClickOutSideDemo = () => {
167
167
 
168
168
  ClickOutSideDemo.story = {
169
169
  name: 'ClickOutSideDemo',
170
- };
170
+ };
171
+
172
+ export const PromiseCallback = () => {
173
+ const onConfirm = () => {
174
+ return new Promise((resolve, reject) => {
175
+ setTimeout(() => {
176
+ console.log('ccc');
177
+ resolve(1);
178
+ }, 2000)
179
+ })
180
+ };
181
+
182
+ const onCancel = () => {
183
+ return new Promise((resolve, reject) => {
184
+ setTimeout(() => {
185
+ console.log('ccc');
186
+ reject(1);
187
+ }, 2000)
188
+ })
189
+ };
190
+
191
+ return (
192
+ <Popconfirm
193
+ title="确定是否要保存此修改?"
194
+ content="此修改将不可逆"
195
+ onConfirm={onConfirm}
196
+ onCancel={onCancel}
197
+ >
198
+ <Button>保存</Button>
199
+ </Popconfirm>
200
+ );
201
+ };
202
+
203
+ PromiseCallback.story = {
204
+ name: 'PromiseCallbackDemo',
205
+ };
206
+
@@ -35,14 +35,16 @@ export interface PopconfirmProps extends PopoverProps {
35
35
  zIndex?: number;
36
36
  trigger?: Trigger;
37
37
  position?: Position;
38
- onCancel?: (e: React.MouseEvent) => void;
39
- onConfirm?: (e: React.MouseEvent) => void;
38
+ onCancel?: (e: React.MouseEvent) => Promise<any> | void;
39
+ onConfirm?: (e: React.MouseEvent) => Promise<any> | void;
40
40
  onVisibleChange?: (visible: boolean) => void;
41
41
  onClickOutSide?: (e: React.MouseEvent) => void;
42
42
  }
43
43
 
44
44
  export interface PopconfirmState {
45
45
  visible: boolean;
46
+ cancelLoading: boolean;
47
+ confirmLoading: boolean;
46
48
  }
47
49
 
48
50
  interface PopProps {
@@ -99,6 +101,8 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
99
101
  super(props);
100
102
 
101
103
  this.state = {
104
+ cancelLoading: false,
105
+ confirmLoading: false,
102
106
  visible: props.defaultVisible || false,
103
107
  };
104
108
 
@@ -122,8 +126,10 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
122
126
  return {
123
127
  ...super.adapter,
124
128
  setVisible: (visible: boolean): void => this.setState({ visible }),
125
- notifyConfirm: (e: React.MouseEvent): void => this.props.onConfirm(e),
126
- notifyCancel: (e: React.MouseEvent): void => this.props.onCancel(e),
129
+ updateConfirmLoading: (loading: boolean): void => this.setState({ confirmLoading: loading }),
130
+ updateCancelLoading: (loading: boolean): void => this.setState({ cancelLoading: loading }),
131
+ notifyConfirm: (e: React.MouseEvent): Promise<any> | void => this.props.onConfirm(e),
132
+ notifyCancel: (e: React.MouseEvent): Promise<any> | void => this.props.onCancel(e),
127
133
  notifyVisibleChange: (visible: boolean): void => this.props.onVisibleChange(visible),
128
134
  notifyClickOutSide: (e: React.MouseEvent) => this.props.onClickOutSide(e),
129
135
  };
@@ -141,14 +147,15 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
141
147
 
142
148
  renderControls() {
143
149
  const { okText, cancelText, okType, cancelType, cancelButtonProps, okButtonProps } = this.props;
150
+ const { cancelLoading, confirmLoading } = this.state;
144
151
  return (
145
152
  <LocaleConsumer componentName="Popconfirm">
146
153
  {(locale: LocaleObject['Popconfirm'], localeCode: string) => (
147
154
  <>
148
- <Button type={cancelType} onClick={this.handleCancel} {...cancelButtonProps}>
155
+ <Button type={cancelType} onClick={this.handleCancel} loading={cancelLoading} {...cancelButtonProps}>
149
156
  {cancelText || get(locale, 'cancel')}
150
157
  </Button>
151
- <Button type={okType} theme="solid" onClick={this.handleConfirm} {...okButtonProps}>
158
+ <Button type={okType} theme="solid" onClick={this.handleConfirm} loading={confirmLoading} {...okButtonProps}>
152
159
  {okText || get(locale, 'confirm')}
153
160
  </Button>
154
161
  </>
@@ -171,6 +178,7 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
171
178
  const showContent = content !== null || typeof content !== 'undefined';
172
179
 
173
180
  return (
181
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
174
182
  <div className={popCardCls} onClick={this.stopImmediatePropagation} style={style}>
175
183
  <div className={`${prefixCls}-inner`}>
176
184
  <div className={`${prefixCls}-header`}>
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classnames from 'classnames';
4
- import { get, noop } from 'lodash';
4
+ import { noop } from 'lodash';
5
5
 
6
6
  import { radioGroupClasses as css, strings } from '@douyinfe/semi-foundation/radio/constants';
7
7
  import RadioGroupFoundation, { RadioGroupAdapter } from '@douyinfe/semi-foundation/radio/radioGroupFoundation';
@@ -177,7 +177,6 @@ class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState> {
177
177
  key={index}
178
178
  disabled={this.props.disabled}
179
179
  value={option}
180
- type={type}
181
180
  >
182
181
  {option}
183
182
  </Radio>
@@ -191,7 +190,6 @@ class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState> {
191
190
  extra={option.extra}
192
191
  className={option.className}
193
192
  style={option.style}
194
- type={type}
195
193
  >
196
194
  {option.label}
197
195
  </Radio>
@@ -199,18 +197,9 @@ class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState> {
199
197
  }
200
198
  });
201
199
  } else if (children) {
202
- inner = React.Children.map(children, (itm, index) => {
203
- if (React.isValidElement(itm)) {
204
- const props: Record<string, any> = { key: index };
205
- const isRadioComp = ['Radio', 'RadioWithGroup'].some(comp => [get(itm, 'type.displayName'), get(itm, 'type.name')].includes(comp));
206
- if (isRadioComp) {
207
- props.type = type;
208
- }
209
- return React.cloneElement(itm, props);
210
- } else {
211
- return null;
212
- }
213
- });
200
+ inner = React.Children.map(children, (itm, index) => (React.isValidElement(itm) ?
201
+ React.cloneElement(itm, { key: index }) :
202
+ null));
214
203
  }
215
204
 
216
205
  return (
@@ -164,12 +164,13 @@ export default function ColumnFilter(props: ColumnFilterProps = {}): React.React
164
164
  } else {
165
165
  iconElem = (
166
166
  <div className={finalCls}>
167
+ {'\u200b'/* ZWSP(zero-width space) */}
167
168
  <IconFilter
168
169
  role="button"
169
170
  aria-label="Filter data with this column"
170
171
  aria-haspopup="listbox"
171
172
  tabIndex={-1}
172
- size="small"
173
+ size="default"
173
174
  />
174
175
  </div>
175
176
  );
@@ -15,6 +15,7 @@ export interface ColumnSorterProps {
15
15
  onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
16
16
  prefixCls?: string;
17
17
  sortOrder?: SortOrder;
18
+ title?: React.ReactNode;
18
19
  }
19
20
 
20
21
  export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
@@ -33,9 +34,9 @@ export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
33
34
  };
34
35
 
35
36
  render() {
36
- const { prefixCls, onClick, sortOrder, style } = this.props;
37
+ const { prefixCls, onClick, sortOrder, style, title } = this.props;
37
38
 
38
- const iconBtnSize = 'small';
39
+ const iconBtnSize = 'default';
39
40
 
40
41
  const upCls = cls(`${prefixCls}-column-sorter-up`, {
41
42
  on: sortOrder === strings.SORT_DIRECTIONS[0],
@@ -58,17 +59,22 @@ export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
58
59
  role='button'
59
60
  {...ariaProps}
60
61
  tabIndex={-1}
61
- style={style}
62
- className={`${prefixCls}-column-sorter`}
62
+ className={`${prefixCls}-column-sorter-wrapper`}
63
63
  onClick={onClick}
64
64
  onKeyPress={e => isEnterPress(e) && onClick(e as any)}
65
65
  >
66
- <span className={`${upCls}`}>
67
- <IconCaretup size={iconBtnSize} />
68
- </span>
69
- <span className={`${downCls}`}>
70
- <IconCaretdown size={iconBtnSize} />
71
- </span>
66
+ {title}
67
+ <div
68
+ style={style}
69
+ className={`${prefixCls}-column-sorter`}
70
+ >
71
+ <span className={`${upCls}`}>
72
+ <IconCaretup size={iconBtnSize} />
73
+ </span>
74
+ <span className={`${downCls}`}>
75
+ <IconCaretdown size={iconBtnSize} />
76
+ </span>
77
+ </div>
72
78
  </div>
73
79
  );
74
80
  }
package/table/Table.tsx CHANGED
@@ -933,16 +933,22 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
933
933
  const stateSortOrder = get(curQuery, 'sortOrder');
934
934
  const defaultSortOrder = get(curQuery, 'defaultSortOrder', false);
935
935
  const sortOrder = this.foundation.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
936
+ const TitleNode = typeof rawTitle !== 'function' && <React.Fragment key={strings.DEFAULT_KEY_COLUMN_TITLE}>{rawTitle as React.ReactNode}</React.Fragment>;
936
937
  if (typeof column.sorter === 'function' || column.sorter === true) {
938
+ // In order to increase the click hot area of ​​sorting, when sorting is required & useFullRender is false,
939
+ // both the title and sorting areas are used as the click hot area for sorting。
937
940
  const sorter = (
938
941
  <ColumnSorter
939
942
  key={strings.DEFAULT_KEY_COLUMN_SORTER}
940
943
  sortOrder={sortOrder}
941
944
  onClick={e => this.foundation.handleSort(column, e)}
945
+ title={TitleNode}
942
946
  />
943
947
  );
944
948
  useFullRender && (titleMap.sorter = sorter);
945
949
  titleArr.push(sorter);
950
+ } else {
951
+ titleArr.push(TitleNode);
946
952
  }
947
953
 
948
954
  const stateFilteredValue = get(curQuery, 'filteredValue');
@@ -964,10 +970,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
964
970
 
965
971
  const newTitle =
966
972
  typeof rawTitle === 'function' ?
967
- () => rawTitle(titleMap) :
968
- titleArr.unshift(
969
- <React.Fragment key={strings.DEFAULT_KEY_COLUMN_TITLE}>{rawTitle}</React.Fragment>
970
- ) && titleArr;
973
+ () => rawTitle(titleMap) : titleArr;
971
974
 
972
975
  column = { ...column, title: newTitle };
973
976
  }