@douyinfe/semi-ui 2.17.0 → 2.19.0-alpha.0

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 (179) hide show
  1. package/anchor/index.tsx +1 -1
  2. package/anchor/link.tsx +3 -4
  3. package/autoComplete/__test__/autoComplete.test.js +6 -6
  4. package/autoComplete/index.tsx +3 -1
  5. package/autoComplete/option.tsx +164 -0
  6. package/calendar/__test__/calendar.test.js +21 -2
  7. package/calendar/_story/calendar.stories.js +31 -0
  8. package/calendar/index.tsx +3 -1
  9. package/calendar/interface.ts +2 -1
  10. package/carousel/index.tsx +5 -5
  11. package/checkbox/checkbox.tsx +10 -2
  12. package/dist/css/semi.css +174 -29
  13. package/dist/css/semi.min.css +1 -1
  14. package/dist/umd/semi-ui.js +4190 -5430
  15. package/dist/umd/semi-ui.js.map +1 -1
  16. package/dist/umd/semi-ui.min.js +1 -1
  17. package/dist/umd/semi-ui.min.js.map +1 -1
  18. package/form/_story/FieldProps/labelOptional.jsx +30 -0
  19. package/form/_story/form.stories.js +7 -0
  20. package/form/hoc/withField.tsx +1 -0
  21. package/form/label.tsx +21 -7
  22. package/gulpfile.js +3 -1
  23. package/lib/cjs/_base/base.css +35 -0
  24. package/lib/cjs/anchor/index.js +2 -1
  25. package/lib/cjs/anchor/link.d.ts +1 -1
  26. package/lib/cjs/anchor/link.js +9 -5
  27. package/lib/cjs/autoComplete/index.d.ts +1 -1
  28. package/lib/cjs/autoComplete/index.js +6 -3
  29. package/lib/cjs/autoComplete/option.d.ts +50 -0
  30. package/lib/cjs/autoComplete/option.js +218 -0
  31. package/lib/cjs/calendar/index.d.ts +2 -0
  32. package/lib/cjs/calendar/index.js +3 -1
  33. package/lib/cjs/calendar/interface.d.ts +2 -1
  34. package/lib/cjs/carousel/index.js +2 -2
  35. package/lib/cjs/checkbox/checkbox.d.ts +4 -0
  36. package/lib/cjs/checkbox/checkbox.js +9 -3
  37. package/lib/cjs/form/hoc/withField.js +2 -1
  38. package/lib/cjs/form/label.d.ts +8 -5
  39. package/lib/cjs/form/label.js +15 -4
  40. package/lib/cjs/locale/interface.d.ts +3 -0
  41. package/lib/cjs/locale/source/ar.js +3 -0
  42. package/lib/cjs/locale/source/de.js +3 -0
  43. package/lib/cjs/locale/source/en_GB.js +3 -0
  44. package/lib/cjs/locale/source/en_US.js +3 -0
  45. package/lib/cjs/locale/source/es.js +3 -0
  46. package/lib/cjs/locale/source/fr.js +3 -0
  47. package/lib/cjs/locale/source/id_ID.js +3 -0
  48. package/lib/cjs/locale/source/it.js +3 -0
  49. package/lib/cjs/locale/source/ja_JP.js +3 -0
  50. package/lib/cjs/locale/source/ko_KR.js +3 -0
  51. package/lib/cjs/locale/source/ms_MY.js +3 -0
  52. package/lib/cjs/locale/source/pt_BR.js +3 -0
  53. package/lib/cjs/locale/source/ru_RU.js +3 -0
  54. package/lib/cjs/locale/source/th_TH.js +3 -0
  55. package/lib/cjs/locale/source/tr_TR.js +3 -0
  56. package/lib/cjs/locale/source/vi_VN.js +3 -0
  57. package/lib/cjs/locale/source/zh_CN.js +3 -0
  58. package/lib/cjs/locale/source/zh_TW.js +3 -0
  59. package/lib/cjs/modal/Modal.js +0 -8
  60. package/lib/cjs/modal/ModalContent.js +4 -1
  61. package/lib/cjs/radio/radio.d.ts +2 -0
  62. package/lib/cjs/radio/radio.js +33 -8
  63. package/lib/cjs/table/ColumnFilter.js +4 -2
  64. package/lib/cjs/table/ColumnSorter.d.ts +1 -0
  65. package/lib/cjs/table/ColumnSorter.js +9 -6
  66. package/lib/cjs/table/Table.js +11 -4
  67. package/lib/cjs/tag/group.d.ts +3 -0
  68. package/lib/cjs/tag/group.js +24 -6
  69. package/lib/cjs/tag/index.d.ts +2 -1
  70. package/lib/cjs/tag/index.js +7 -5
  71. package/lib/cjs/tag/interface.d.ts +2 -1
  72. package/lib/cjs/tree/index.d.ts +3 -1
  73. package/lib/cjs/tree/index.js +23 -0
  74. package/lib/cjs/tree/interface.d.ts +4 -0
  75. package/lib/cjs/tree/treeNode.d.ts +4 -1
  76. package/lib/cjs/tree/treeNode.js +13 -4
  77. package/lib/es/_base/base.css +35 -0
  78. package/lib/es/anchor/index.js +2 -1
  79. package/lib/es/anchor/link.d.ts +1 -1
  80. package/lib/es/anchor/link.js +9 -5
  81. package/lib/es/autoComplete/index.d.ts +1 -1
  82. package/lib/es/autoComplete/index.js +6 -3
  83. package/lib/es/autoComplete/option.d.ts +50 -0
  84. package/lib/es/autoComplete/option.js +188 -0
  85. package/lib/es/calendar/index.d.ts +2 -0
  86. package/lib/es/calendar/index.js +3 -1
  87. package/lib/es/calendar/interface.d.ts +2 -1
  88. package/lib/es/carousel/index.js +2 -2
  89. package/lib/es/checkbox/checkbox.d.ts +4 -0
  90. package/lib/es/checkbox/checkbox.js +10 -4
  91. package/lib/es/form/hoc/withField.js +2 -1
  92. package/lib/es/form/label.d.ts +8 -5
  93. package/lib/es/form/label.js +13 -4
  94. package/lib/es/locale/interface.d.ts +3 -0
  95. package/lib/es/locale/source/ar.js +3 -0
  96. package/lib/es/locale/source/de.js +3 -0
  97. package/lib/es/locale/source/en_GB.js +3 -0
  98. package/lib/es/locale/source/en_US.js +3 -0
  99. package/lib/es/locale/source/es.js +3 -0
  100. package/lib/es/locale/source/fr.js +3 -0
  101. package/lib/es/locale/source/id_ID.js +3 -0
  102. package/lib/es/locale/source/it.js +3 -0
  103. package/lib/es/locale/source/ja_JP.js +3 -0
  104. package/lib/es/locale/source/ko_KR.js +3 -0
  105. package/lib/es/locale/source/ms_MY.js +3 -0
  106. package/lib/es/locale/source/pt_BR.js +3 -0
  107. package/lib/es/locale/source/ru_RU.js +3 -0
  108. package/lib/es/locale/source/th_TH.js +3 -0
  109. package/lib/es/locale/source/tr_TR.js +3 -0
  110. package/lib/es/locale/source/vi_VN.js +3 -0
  111. package/lib/es/locale/source/zh_CN.js +3 -0
  112. package/lib/es/locale/source/zh_TW.js +3 -0
  113. package/lib/es/modal/Modal.js +0 -8
  114. package/lib/es/modal/ModalContent.js +4 -1
  115. package/lib/es/radio/radio.d.ts +2 -0
  116. package/lib/es/radio/radio.js +31 -8
  117. package/lib/es/table/ColumnFilter.js +4 -2
  118. package/lib/es/table/ColumnSorter.d.ts +1 -0
  119. package/lib/es/table/ColumnSorter.js +9 -6
  120. package/lib/es/table/Table.js +10 -4
  121. package/lib/es/tag/group.d.ts +3 -0
  122. package/lib/es/tag/group.js +24 -6
  123. package/lib/es/tag/index.d.ts +2 -1
  124. package/lib/es/tag/index.js +7 -5
  125. package/lib/es/tag/interface.d.ts +2 -1
  126. package/lib/es/tree/index.d.ts +3 -1
  127. package/lib/es/tree/index.js +22 -0
  128. package/lib/es/tree/interface.d.ts +4 -0
  129. package/lib/es/tree/treeNode.d.ts +4 -1
  130. package/lib/es/tree/treeNode.js +13 -4
  131. package/locale/interface.ts +3 -0
  132. package/locale/source/ar.ts +3 -0
  133. package/locale/source/de.ts +3 -0
  134. package/locale/source/en_GB.ts +3 -0
  135. package/locale/source/en_US.ts +3 -0
  136. package/locale/source/es.ts +3 -0
  137. package/locale/source/fr.ts +3 -0
  138. package/locale/source/id_ID.ts +3 -0
  139. package/locale/source/it.ts +3 -0
  140. package/locale/source/ja_JP.ts +3 -0
  141. package/locale/source/ko_KR.ts +3 -0
  142. package/locale/source/ms_MY.ts +3 -0
  143. package/locale/source/pt_BR.ts +3 -0
  144. package/locale/source/ru_RU.ts +3 -0
  145. package/locale/source/th_TH.ts +3 -0
  146. package/locale/source/tr_TR.ts +4 -1
  147. package/locale/source/vi_VN.ts +3 -0
  148. package/locale/source/zh_CN.ts +3 -0
  149. package/locale/source/zh_TW.ts +3 -0
  150. package/modal/Modal.tsx +0 -6
  151. package/modal/ModalContent.tsx +4 -1
  152. package/modal/__test__/modal.test.js +1 -1
  153. package/modal/_story/__snapshots__/modal.stories.tsx.snap +203 -0
  154. package/package.json +7 -7
  155. package/radio/_story/radio.stories.js +2 -2
  156. package/radio/radio.tsx +27 -5
  157. package/rating/__test__/rating.test.js +1 -1
  158. package/select/__test__/select.test.js +11 -17
  159. package/select/_story/select.stories.js +6 -6
  160. package/steps/_story/steps.stories.js +3 -3
  161. package/switch/_story/switch.stories.js +4 -4
  162. package/switch/_story/switch.stories.tsx +4 -4
  163. package/table/ColumnFilter.tsx +2 -1
  164. package/table/ColumnSorter.tsx +16 -10
  165. package/table/Table.tsx +7 -4
  166. package/table/_story/v2/FixedFilter/index.tsx +106 -0
  167. package/table/_story/v2/FixedSorter/index.tsx +102 -0
  168. package/table/_story/v2/index.js +4 -2
  169. package/tag/_story/tag.stories.js +57 -1
  170. package/tag/group.tsx +20 -3
  171. package/tag/index.tsx +6 -5
  172. package/tag/interface.ts +2 -1
  173. package/transfer/_story/transfer.stories.js +2 -2
  174. package/tree/_story/tree.stories.js +152 -3
  175. package/tree/index.tsx +16 -1
  176. package/tree/interface.ts +6 -0
  177. package/tree/treeNode.tsx +11 -5
  178. package/upload/_story/upload.stories.js +2 -2
  179. package/webpack.config.js +13 -3
@@ -0,0 +1,203 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`模态框-点击遮罩层不可关闭 1`] = `
4
+ <DialogComponent
5
+ maskClosable={false}
6
+ >
7
+ <Button
8
+ onClick={[Function]}
9
+ >
10
+ <Button
11
+ block={false}
12
+ disabled={false}
13
+ htmlType="button"
14
+ onClick={[Function]}
15
+ onMouseDown={[Function]}
16
+ onMouseEnter={[Function]}
17
+ onMouseLeave={[Function]}
18
+ prefixCls="semi-button"
19
+ size="default"
20
+ theme="light"
21
+ type="primary"
22
+ >
23
+ <button
24
+ aria-disabled={false}
25
+ className="semi-button semi-button-primary semi-button-light"
26
+ disabled={false}
27
+ onClick={[Function]}
28
+ onMouseDown={[Function]}
29
+ onMouseEnter={[Function]}
30
+ onMouseLeave={[Function]}
31
+ type="button"
32
+ >
33
+ <span
34
+ className="semi-button-content"
35
+ onClick={[Function]}
36
+ x-semi-prop="children"
37
+ >
38
+ show dialog
39
+ </span>
40
+ </button>
41
+ </Button>
42
+ </Button>
43
+ <Button
44
+ onClick={[Function]}
45
+ >
46
+ <Button
47
+ block={false}
48
+ disabled={false}
49
+ htmlType="button"
50
+ onClick={[Function]}
51
+ onMouseDown={[Function]}
52
+ onMouseEnter={[Function]}
53
+ onMouseLeave={[Function]}
54
+ prefixCls="semi-button"
55
+ size="default"
56
+ theme="light"
57
+ type="primary"
58
+ >
59
+ <button
60
+ aria-disabled={false}
61
+ className="semi-button semi-button-primary semi-button-light"
62
+ disabled={false}
63
+ onClick={[Function]}
64
+ onMouseDown={[Function]}
65
+ onMouseEnter={[Function]}
66
+ onMouseLeave={[Function]}
67
+ type="button"
68
+ >
69
+ <span
70
+ className="semi-button-content"
71
+ onClick={[Function]}
72
+ x-semi-prop="children"
73
+ >
74
+ 静态调用
75
+ </span>
76
+ </button>
77
+ </Button>
78
+ </Button>
79
+ <Modal
80
+ afterClose={[Function]}
81
+ cancelLoading={false}
82
+ centered={false}
83
+ closable={true}
84
+ closeOnEsc={true}
85
+ confirmLoading={false}
86
+ fullScreen={false}
87
+ hasCancel={true}
88
+ keepDOM={false}
89
+ lazyRender={true}
90
+ mask={true}
91
+ maskClosable={false}
92
+ maskFixed={false}
93
+ motion={true}
94
+ okType="primary"
95
+ onCancel={[Function]}
96
+ onOk={[Function]}
97
+ size="small"
98
+ title="对话框标题"
99
+ visible={false}
100
+ zIndex={1000}
101
+ />
102
+ </DialogComponent>
103
+ `;
104
+
105
+ exports[`模态框默认 1`] = `
106
+ <DialogComponent>
107
+ <Button
108
+ onClick={[Function]}
109
+ >
110
+ <Button
111
+ block={false}
112
+ disabled={false}
113
+ htmlType="button"
114
+ onClick={[Function]}
115
+ onMouseDown={[Function]}
116
+ onMouseEnter={[Function]}
117
+ onMouseLeave={[Function]}
118
+ prefixCls="semi-button"
119
+ size="default"
120
+ theme="light"
121
+ type="primary"
122
+ >
123
+ <button
124
+ aria-disabled={false}
125
+ className="semi-button semi-button-primary semi-button-light"
126
+ disabled={false}
127
+ onClick={[Function]}
128
+ onMouseDown={[Function]}
129
+ onMouseEnter={[Function]}
130
+ onMouseLeave={[Function]}
131
+ type="button"
132
+ >
133
+ <span
134
+ className="semi-button-content"
135
+ onClick={[Function]}
136
+ x-semi-prop="children"
137
+ >
138
+ show dialog
139
+ </span>
140
+ </button>
141
+ </Button>
142
+ </Button>
143
+ <Button
144
+ onClick={[Function]}
145
+ >
146
+ <Button
147
+ block={false}
148
+ disabled={false}
149
+ htmlType="button"
150
+ onClick={[Function]}
151
+ onMouseDown={[Function]}
152
+ onMouseEnter={[Function]}
153
+ onMouseLeave={[Function]}
154
+ prefixCls="semi-button"
155
+ size="default"
156
+ theme="light"
157
+ type="primary"
158
+ >
159
+ <button
160
+ aria-disabled={false}
161
+ className="semi-button semi-button-primary semi-button-light"
162
+ disabled={false}
163
+ onClick={[Function]}
164
+ onMouseDown={[Function]}
165
+ onMouseEnter={[Function]}
166
+ onMouseLeave={[Function]}
167
+ type="button"
168
+ >
169
+ <span
170
+ className="semi-button-content"
171
+ onClick={[Function]}
172
+ x-semi-prop="children"
173
+ >
174
+ 静态调用
175
+ </span>
176
+ </button>
177
+ </Button>
178
+ </Button>
179
+ <Modal
180
+ afterClose={[Function]}
181
+ cancelLoading={false}
182
+ centered={false}
183
+ closable={true}
184
+ closeOnEsc={true}
185
+ confirmLoading={false}
186
+ fullScreen={false}
187
+ hasCancel={true}
188
+ keepDOM={false}
189
+ lazyRender={true}
190
+ mask={true}
191
+ maskClosable={true}
192
+ maskFixed={false}
193
+ motion={true}
194
+ okType="primary"
195
+ onCancel={[Function]}
196
+ onOk={[Function]}
197
+ size="small"
198
+ title="对话框标题"
199
+ visible={false}
200
+ zIndex={1000}
201
+ />
202
+ </DialogComponent>
203
+ `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.17.0",
3
+ "version": "2.19.0-alpha.0",
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.17.0",
19
- "@douyinfe/semi-foundation": "2.17.0",
20
- "@douyinfe/semi-icons": "2.17.0",
18
+ "@douyinfe/semi-animation-react": "2.19.0-alpha.0",
19
+ "@douyinfe/semi-foundation": "2.19.0-alpha.0",
20
+ "@douyinfe/semi-icons": "2.19.0-alpha.0",
21
21
  "@douyinfe/semi-illustrations": "2.15.0",
22
- "@douyinfe/semi-theme-default": "2.17.0",
22
+ "@douyinfe/semi-theme-default": "2.19.0-alpha.0",
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": "802e57ecc50de44c7ad4b2322bdd864eb9727cc3",
69
+ "gitHead": "58f801d44b0fb3079606c9e7b060f5c782d37e0a",
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.17.0",
75
+ "@douyinfe/semi-scss-compile": "2.19.0-alpha.0",
76
76
  "@storybook/addon-knobs": "^6.3.1",
77
77
  "@types/lodash": "^4.14.176",
78
78
  "@types/react": ">=16.0.0",
@@ -196,7 +196,7 @@ const RadioGroup1 = () => {
196
196
  </div>
197
197
  );
198
198
  };
199
- class RadioWithControled extends React.Component {
199
+ class RadioWithControlled extends React.Component {
200
200
  constructor(props) {
201
201
  super(props);
202
202
  this.state = {
@@ -240,7 +240,7 @@ export const _RadioGroup = () => {
240
240
  </RadioGroup>
241
241
  <br />
242
242
  value+onchange
243
- <RadioWithControled />
243
+ <RadioWithControlled />
244
244
  <br />
245
245
  联动
246
246
  <RadioGroup1 />
package/radio/radio.tsx CHANGED
@@ -2,7 +2,7 @@
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import cls from 'classnames';
5
- import { noop } from 'lodash';
5
+ import { noop, isUndefined, isBoolean } from 'lodash';
6
6
 
7
7
  import RadioFoundation, { RadioAdapter } from '@douyinfe/semi-foundation/radio/radioFoundation';
8
8
  import { RadioChangeEvent } from '@douyinfe/semi-foundation/radio/radioInnerFoundation';
@@ -52,6 +52,7 @@ export interface RadioState {
52
52
  addonId?: string;
53
53
  extraId?: string;
54
54
  focusVisible?: boolean;
55
+ checked?: boolean;
55
56
  }
56
57
 
57
58
  export { RadioChangeEvent };
@@ -104,11 +105,22 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
104
105
  hover: false,
105
106
  addonId: props.addonId,
106
107
  extraId: props.extraId,
108
+ checked: props.checked || props.defaultChecked || false,
107
109
  };
108
110
  this.foundation = new RadioFoundation(this.adapter);
109
111
  this.radioEntity = null;
110
112
  }
111
113
 
114
+ componentDidUpdate(prevProps: RadioProps) {
115
+ if (this.props.checked !== prevProps.checked) {
116
+ if (isUndefined(this.props.checked)) {
117
+ this.foundation.setChecked(false);
118
+ } else if (isBoolean(this.props.checked)) {
119
+ this.foundation.setChecked(this.props.checked);
120
+ }
121
+ }
122
+ }
123
+
112
124
  get adapter(): RadioAdapter {
113
125
  return {
114
126
  ...super.adapter,
@@ -118,6 +130,9 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
118
130
  setAddonId: () => {
119
131
  this.setState({ addonId: getUuidShort({ prefix: 'addon' }) });
120
132
  },
133
+ setChecked: (checked: boolean) => {
134
+ this.setState({ checked });
135
+ },
121
136
  setExtraId: () => {
122
137
  this.setState({ extraId: getUuidShort({ prefix: 'extra' }) });
123
138
  },
@@ -146,6 +161,7 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
146
161
  const { radioGroup } = this.context;
147
162
  radioGroup.onChange && radioGroup.onChange(e);
148
163
  }
164
+ !('checked' in this.props) && this.foundation.setChecked(e.target.checked);
149
165
  onChange && onChange(e);
150
166
  };
151
167
 
@@ -171,7 +187,6 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
171
187
  const {
172
188
  addonClassName,
173
189
  addonStyle,
174
- checked,
175
190
  disabled,
176
191
  style,
177
192
  className,
@@ -194,8 +209,11 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
194
209
  isButtonRadioComponent,
195
210
  buttonSize,
196
211
  realPrefixCls;
197
- const { hover: isHover, addonId, extraId, focusVisible } = this.state;
198
- let props = {};
212
+ const { hover: isHover, addonId, extraId, focusVisible, checked, } = this.state;
213
+ const props: Record<string, any> = {
214
+ checked,
215
+ disabled,
216
+ };
199
217
 
200
218
  if (this.isInGroup()) {
201
219
  realChecked = this.context.radioGroup.value === propValue;
@@ -206,13 +224,17 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
206
224
  isPureCardRadioGroup = this.context.radioGroup.isPureCardRadio;
207
225
  buttonSize = this.context.radioGroup.buttonSize;
208
226
  realPrefixCls = prefixCls || this.context.radioGroup.prefixCls;
209
- props = { checked: realChecked, disabled: isDisabled };
227
+ props.checked = realChecked;
228
+ props.disabled = isDisabled;
210
229
  } else {
211
230
  realChecked = checked;
212
231
  isDisabled = disabled;
213
232
  realMode = mode;
214
233
  isButtonRadioComponent = type === 'button';
215
234
  realPrefixCls = prefixCls;
235
+ isButtonRadioGroup = type === strings.TYPE_BUTTON;
236
+ isPureCardRadioGroup = type === strings.TYPE_PURECARD;
237
+ isCardRadioGroup = type === strings.TYPE_CARD || isPureCardRadioGroup;
216
238
  }
217
239
  const isButtonRadio = typeof isButtonRadioGroup === 'undefined' ? isButtonRadioComponent : isButtonRadioGroup;
218
240
 
@@ -85,7 +85,7 @@ describe('Rating', () => {
85
85
  expect(spyOnChange.calledWithMatch(1)).toBe(true);
86
86
  });
87
87
 
88
- it('controled value', () => {
88
+ it('controlled value', () => {
89
89
  const R = getRating({ value: 2 });
90
90
  expect(R.state().value).toEqual(2);
91
91
  expect(R.find(`.${BASE_CLASS_PREFIX}-rating-star-full`).length).toEqual(2);
@@ -20,7 +20,7 @@ function getOption(list = defaultList) {
20
20
  let commonProps = {
21
21
  // Select use Popup Layer to show candidate option,
22
22
  // but all Popup Layer which extends from Tooltip (eg Popover, Dropdown) have animation and delay.
23
- // Turn off animation and delay during testing, to avoid wating (something like setTimeOut/balabala...) in the test code
23
+ // Turn off animation and delay during testing, to avoid waiting (something like setTimeOut/balabala...) in the test code
24
24
  motion: false,
25
25
  mouseEnterDelay: 0,
26
26
  mouseLeaveDelay: 0,
@@ -467,7 +467,7 @@ describe('Select', () => {
467
467
  const props = { disabled: true };
468
468
  const select = getSelect(props);
469
469
  expect(select.exists(`.${BASE_CLASS_PREFIX}-select-disabled`)).toEqual(true);
470
- // Does not respond click events when disbaled is true
470
+ // Does not respond click events when disabled is true
471
471
  select.find(`.${BASE_CLASS_PREFIX}-select`).simulate('click', {});
472
472
  expect(select.exists(`.${BASE_CLASS_PREFIX}-select-option-list`)).toEqual(false);
473
473
  });
@@ -556,12 +556,6 @@ describe('Select', () => {
556
556
  select.unmount();
557
557
  // when click clear button, should trigger onSearch
558
558
  // TODO
559
- let scProps = {
560
- showClear: true,
561
- filter: true,
562
- defaultValue: 'tikok',
563
- };
564
- const scSelect = getSelect(props);
565
559
  });
566
560
 
567
561
  it('emptyContent', () => {
@@ -718,7 +712,7 @@ describe('Select', () => {
718
712
  });
719
713
 
720
714
  it('onDeselect', () => {
721
- // trigger onDeselect when option is deselectd
715
+ // trigger onDeselect when option is deselected
722
716
  let onDeselect = (value, option) => {};
723
717
  let spyOnDeselect = sinon.spy(onDeselect);
724
718
  let props = {
@@ -916,7 +910,7 @@ describe('Select', () => {
916
910
  });
917
911
 
918
912
  it('【autoFocus】 & onBlur when autoFocus = true', () => {
919
- // autoFocus should trigger onBlur when click ohter element directly (dropdown not open)
913
+ // autoFocus should trigger onBlur when click other element directly (dropdown not open)
920
914
  let spyOnBlur = sinon.spy((value, option) => {
921
915
  });
922
916
  let props = {
@@ -936,7 +930,7 @@ describe('Select', () => {
936
930
  expect(spyOnBlur.callCount).toEqual(1);
937
931
  });
938
932
 
939
- it('vitrual', () => {
933
+ it('virtual', () => {
940
934
  let spyOnChange = sinon.spy((value) => {
941
935
  });
942
936
  let optionList = Array.from({ length: 100 }, (v, i) => ({ label: `option-${i}`, value: i }));
@@ -1048,7 +1042,7 @@ describe('Select', () => {
1048
1042
  it('customTrigger', () => {
1049
1043
  const triggerRender = ({ value, ...rest }) => {
1050
1044
  return (
1051
- <div className="custom-triger">
1045
+ <div className="custom-trigger">
1052
1046
  trigger
1053
1047
  </div>
1054
1048
  );
@@ -1057,7 +1051,7 @@ describe('Select', () => {
1057
1051
  triggerRender,
1058
1052
  };
1059
1053
  let select = getSelect(props);
1060
- let trigger = select.find('.custom-triger');
1054
+ let trigger = select.find('.custom-trigger');
1061
1055
  expect(trigger.length).toEqual(1);
1062
1056
  expect(trigger.at(0).text()).toEqual('trigger');
1063
1057
  trigger.at(0).simulate('click')
@@ -1186,7 +1180,7 @@ describe('Select', () => {
1186
1180
  expect(singleSelect.state().selections.size).toEqual(0);
1187
1181
  });
1188
1182
 
1189
- it('props optionList update after choose some option, uncontroled mode', () => {
1183
+ it('props optionList update after choose some option, uncontrolled mode', () => {
1190
1184
 
1191
1185
  let props = {
1192
1186
  defaultActiveFirstOption: true,
@@ -1234,7 +1228,7 @@ describe('Select', () => {
1234
1228
  expect(selections2[0][0]).toEqual('abc');
1235
1229
  });
1236
1230
 
1237
- it('click tag close when multiple, controled mode', () => {
1231
+ it('click tag close when multiple, controlled mode', () => {
1238
1232
  let spyOnChange = sinon.spy((value) => {
1239
1233
  });
1240
1234
  let spyOnDeselect = sinon.spy((option) => {
@@ -1303,8 +1297,8 @@ describe('Select', () => {
1303
1297
  expect(inputValue).toEqual(keyword);
1304
1298
  });
1305
1299
  // TODO ref selectAll \deselectAll when onChangeWithObject is true
1306
- // TODO when loading is true, do not response any keyborard event
1307
- // TODO can't remove tag when option is diabled
1300
+ // TODO when loading is true, do not response any keyboard event
1301
+ // TODO can't remove tag when option is disabled
1308
1302
  // it('allowCreate-renderCreateItem', ()=>{})
1309
1303
  // it('autoAdjustOverflow', ()=>{})
1310
1304
  // it('remote', ()=>{})
@@ -1183,7 +1183,7 @@ RenderSelectedItem.parameters = {
1183
1183
  chromatic: { disableSnapshot: false },
1184
1184
  };
1185
1185
 
1186
- const ControledSelect = () => {
1186
+ const ControlledSelect = () => {
1187
1187
  const [value, setValue] = useState('nick');
1188
1188
  const [value2, setValue2] = useState('jerry');
1189
1189
  const [value3, setValue3] = useState();
@@ -1277,13 +1277,13 @@ const ControledSelect = () => {
1277
1277
  );
1278
1278
  };
1279
1279
 
1280
- export const Controlled = () => <ControledSelect></ControledSelect>;
1280
+ export const Controlled = () => <ControlledSelect></ControlledSelect>;
1281
1281
 
1282
1282
  Controlled.story = {
1283
1283
  name: 'controlled',
1284
1284
  };
1285
1285
 
1286
- const UnControledSelect = () => {
1286
+ const UnControlledSelect = () => {
1287
1287
  const onChange = value => {
1288
1288
  console.log(value);
1289
1289
  };
@@ -1318,8 +1318,8 @@ const UnControledSelect = () => {
1318
1318
  );
1319
1319
  };
1320
1320
 
1321
- export { UnControledSelect };
1322
- UnControledSelect.story = {
1321
+ export { UnControlledSelect };
1322
+ UnControlledSelect.story = {
1323
1323
  name: '非受控组件'
1324
1324
  };
1325
1325
 
@@ -1800,7 +1800,7 @@ AllowCreateCustomRender.story = {
1800
1800
  name: 'allowCreate custom render',
1801
1801
  };
1802
1802
 
1803
- let AllowCreateControledDemo = () => {
1803
+ let AllowCreateControlledDemo = () => {
1804
1804
  let [value, setValue] = useState();
1805
1805
  const optionList = [
1806
1806
  {
@@ -199,12 +199,12 @@ class StepsDemo extends React.Component {
199
199
  }
200
200
  }
201
201
 
202
- export const StepsWithControled = () => {
202
+ export const StepsWithControlled = () => {
203
203
  return <StepsDemo></StepsDemo>;
204
204
  };
205
205
 
206
- StepsWithControled.story = {
207
- name: 'steps with controled',
206
+ StepsWithControlled.story = {
207
+ name: 'steps with controlled',
208
208
  };
209
209
 
210
210
  class StepsWithonChange extends React.Component {
@@ -65,17 +65,17 @@ SwitchDisabled.story = {
65
65
  name: 'switch disabled',
66
66
  };
67
67
 
68
- const ControledSwitch = () => {
68
+ const ControlledSwitch = () => {
69
69
  const [checked, onChange] = useState(true);
70
70
  return <Switch checked={checked} onChange={(v, e) => onChange(v)} aria-label='power-switch'/>;
71
71
  };
72
- export const SwitchCheckedOnChange = () => <ControledSwitch />;
72
+ export const SwitchCheckedOnChange = () => <ControlledSwitch />;
73
73
 
74
74
  SwitchCheckedOnChange.story = {
75
75
  name: 'switch checked + onChange',
76
76
  };
77
77
 
78
- const UnControledSwitch = () => {
78
+ const UnControlledSwitch = () => {
79
79
  const onChange = checked => {
80
80
  console.log(checked);
81
81
  };
@@ -86,7 +86,7 @@ const UnControledSwitch = () => {
86
86
  </>
87
87
  );
88
88
  };
89
- export const SwitchDefaultCheckedOnChange = () => <UnControledSwitch />;
89
+ export const SwitchDefaultCheckedOnChange = () => <UnControlledSwitch />;
90
90
 
91
91
  SwitchDefaultCheckedOnChange.story = {
92
92
  name: 'switch defaultChecked + onChange',
@@ -57,15 +57,15 @@ stories.add('switch disabled', () => (
57
57
  ));
58
58
 
59
59
 
60
- const ControledSwitch = () => {
60
+ const ControlledSwitch = () => {
61
61
  const [checked, onChange] = useState(true);
62
62
  return (
63
63
  <Switch checked={checked} onChange={(v, e) => onChange(v)} />
64
64
  );
65
65
  };
66
- stories.add('switch checked + onChange', () => <ControledSwitch/>);
66
+ stories.add('switch checked + onChange', () => <ControlledSwitch/>);
67
67
 
68
- const UnControledSwitch = () => {
68
+ const UnControlledSwitch = () => {
69
69
  const onChange = checked => {
70
70
  console.log(checked);
71
71
  };
@@ -76,7 +76,7 @@ const UnControledSwitch = () => {
76
76
  </>
77
77
  );
78
78
  };
79
- stories.add('switch defaultChecked + onChange', () => <UnControledSwitch/>);
79
+ stories.add('switch defaultChecked + onChange', () => <UnControlledSwitch/>);
80
80
 
81
81
  class LoadingDemo extends React.Component {
82
82
  constructor(props) {
@@ -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
  }