@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
@@ -151,7 +151,8 @@ class Checkbox extends _baseComponent.default {
151
151
  value,
152
152
  role,
153
153
  tabIndex,
154
- id
154
+ id,
155
+ type
155
156
  } = this.props;
156
157
  const {
157
158
  checked,
@@ -184,6 +185,9 @@ class Checkbox extends _baseComponent.default {
184
185
  props.isCardType = isCardType;
185
186
  props.isPureCardType = isPureCardType;
186
187
  props['name'] = this.context.checkboxGroup.name;
188
+ } else {
189
+ props.isPureCardType = type === _constants.strings.TYPE_PURECARD;
190
+ props.isCardType = type === _constants.strings.TYPE_CARD || props.isPureCardType;
187
191
  }
188
192
 
189
193
  const prefix = prefixCls || _constants.checkboxClasses.PREFIX;
@@ -274,14 +278,16 @@ Checkbox.propTypes = {
274
278
  index: _propTypes.default.number,
275
279
  'aria-label': _propTypes.default.string,
276
280
  tabIndex: _propTypes.default.number,
277
- preventScroll: _propTypes.default.bool
281
+ preventScroll: _propTypes.default.bool,
282
+ type: _propTypes.default.string
278
283
  };
279
284
  Checkbox.defaultProps = {
280
285
  defaultChecked: false,
281
286
  indeterminate: false,
282
287
  onChange: _noop2.default,
283
288
  onMouseEnter: _noop2.default,
284
- onMouseLeave: _noop2.default
289
+ onMouseLeave: _noop2.default,
290
+ type: 'default'
285
291
  };
286
292
  var _default = Checkbox;
287
293
  exports.default = _default;
@@ -136,7 +136,8 @@ function withField(Component, opts) {
136
136
  if (arrayFieldState) {
137
137
  initVal = arrayFieldState.shouldUseInitValue && typeof initValue !== 'undefined' ? initValue : initValueInFormOpts;
138
138
  }
139
- } catch (err) {}
139
+ } catch (err) {} // FIXME typeof initVal
140
+
140
141
 
141
142
  const [value, setValue, getVal] = (0, _index.useStateWithGetter)(typeof initVal !== undefined ? initVal : null);
142
143
  const validateOnMount = (0, _includes.default)(trigger).call(trigger, 'mount');
@@ -1,22 +1,23 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  export interface LabelProps {
4
+ /** text-align of label */
5
+ align?: string;
6
+ className?: string;
7
+ children?: React.ReactNode;
8
+ disabled?: boolean;
4
9
  id?: string;
5
10
  /** Whether to display the required * symbol */
6
11
  required?: boolean;
7
12
  /** Content of label */
8
13
  text?: React.ReactNode;
9
- disabled?: boolean;
10
14
  /** Used to configure the htmlFor attribute of the label tag */
11
15
  name?: string;
12
- /** text-align of label */
13
- align?: string;
14
16
  /** width of label */
15
17
  width?: number | string;
16
18
  style?: React.CSSProperties;
17
- className?: string;
18
- children?: React.ReactNode;
19
19
  extra?: React.ReactNode;
20
+ optional?: boolean;
20
21
  }
21
22
  export default class Label extends PureComponent<LabelProps> {
22
23
  static defaultProps: {
@@ -24,6 +25,7 @@ export default class Label extends PureComponent<LabelProps> {
24
25
  name: string;
25
26
  align: string;
26
27
  className: string;
28
+ optional: boolean;
27
29
  };
28
30
  static propTypes: {
29
31
  id: PropTypes.Requireable<string>;
@@ -37,6 +39,7 @@ export default class Label extends PureComponent<LabelProps> {
37
39
  style: PropTypes.Requireable<object>;
38
40
  className: PropTypes.Requireable<string>;
39
41
  extra: PropTypes.Requireable<PropTypes.ReactNodeLike>;
42
+ optional: PropTypes.Requireable<boolean>;
40
43
  };
41
44
  render(): JSX.Element;
42
45
  }
@@ -22,6 +22,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
22
22
 
23
23
  var _constants = require("@douyinfe/semi-foundation/lib/cjs/form/constants");
24
24
 
25
+ var _localeConsumer = _interopRequireDefault(require("../locale/localeConsumer"));
26
+
25
27
  function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
26
28
 
27
29
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof 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; }
@@ -41,7 +43,8 @@ class Label extends _react.PureComponent {
41
43
  style,
42
44
  className,
43
45
  extra,
44
- id
46
+ id,
47
+ optional
45
48
  } = this.props;
46
49
  const labelCls = (0, _classnames.default)(className, {
47
50
  ["".concat(prefixCls, "-field-label")]: true,
@@ -54,10 +57,16 @@ class Label extends _react.PureComponent {
54
57
  const labelStyle = style ? style : {};
55
58
  width ? labelStyle.width = width : null;
56
59
 
60
+ const optionalText = /*#__PURE__*/_react.default.createElement(_localeConsumer.default, {
61
+ componentName: "Form"
62
+ }, locale => /*#__PURE__*/_react.default.createElement("span", {
63
+ className: "".concat(prefixCls, "-field-label-optional-text")
64
+ }, locale.optional));
65
+
57
66
  const textContent = /*#__PURE__*/_react.default.createElement("div", {
58
67
  className: "".concat(prefixCls, "-field-label-text"),
59
68
  "x-semi-prop": "label"
60
- }, typeof text !== 'undefined' ? text : children);
69
+ }, typeof text !== 'undefined' ? text : children, optional ? optionalText : null);
61
70
 
62
71
  const contentWithExtra = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, textContent, /*#__PURE__*/_react.default.createElement("div", {
63
72
  className: "".concat(prefixCls, "-field-label-extra")
@@ -78,7 +87,8 @@ Label.defaultProps = {
78
87
  required: false,
79
88
  name: '',
80
89
  align: 'left',
81
- className: ''
90
+ className: '',
91
+ optional: false
82
92
  };
83
93
  Label.propTypes = {
84
94
  id: _propTypes.default.string,
@@ -91,5 +101,6 @@ Label.propTypes = {
91
101
  width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
92
102
  style: _propTypes.default.object,
93
103
  className: _propTypes.default.string,
94
- extra: _propTypes.default.node
104
+ extra: _propTypes.default.node,
105
+ optional: _propTypes.default.bool
95
106
  };
@@ -148,4 +148,7 @@ export interface Locale {
148
148
  total: string;
149
149
  selected: string;
150
150
  };
151
+ Form: {
152
+ optional: string;
153
+ };
151
154
  }
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'إلغاء تحديد الكل',
159
159
  total: 'مجموع ${total} العناصر',
160
160
  selected: '${total} العناصر المحدد'
161
+ },
162
+ Form: {
163
+ optional: '(اختياري)'
161
164
  }
162
165
  }; // [i18n-Arabic]
163
166
 
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Alles abwählen',
159
159
  total: 'Gesamt ${total} Artikel',
160
160
  selected: '${total} ausgewählte Artikel'
161
+ },
162
+ Form: {
163
+ optional: '(Optional)'
161
164
  }
162
165
  }; // [i18n-German]
163
166
 
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Unselect all',
159
159
  total: 'Total ${total} items',
160
160
  selected: '${total} items selected'
161
+ },
162
+ Form: {
163
+ optional: '(optional)'
161
164
  }
162
165
  }; // [i18n-English(GB)]
163
166
 
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Unselect all',
159
159
  total: 'Total ${total} items',
160
160
  selected: '${total} items selected'
161
+ },
162
+ Form: {
163
+ optional: '(optional)'
161
164
  }
162
165
  }; // [i18n-English(US)]
163
166
 
@@ -162,6 +162,9 @@ const locale = {
162
162
  clearSelectAll: 'Deseleccionar todo',
163
163
  total: 'Total ${total} objetos',
164
164
  selected: '${total} objetos seleccionados'
165
+ },
166
+ Form: {
167
+ optional: '(opcional)'
165
168
  }
166
169
  };
167
170
  var _default = locale;
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Désélectionner tout',
159
159
  total: 'Totale ${total} articles',
160
160
  selected: '${total} articles sélectionnés'
161
+ },
162
+ Form: {
163
+ optional: '(optionnel)'
161
164
  }
162
165
  }; // [i18n-French]
163
166
 
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Nyahpilih Semua',
159
159
  total: 'Total ${total} proyek',
160
160
  selected: '${total} item dipilih'
161
+ },
162
+ Form: {
163
+ optional: '(opsional)'
161
164
  }
162
165
  }; // [i18n-Indonesia(ID)]
163
166
 
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Deseleziona tutto',
159
159
  total: 'Totale ${total} elementi',
160
160
  selected: '${total} elementi selezionati'
161
+ },
162
+ Form: {
163
+ optional: '(opzionale)'
161
164
  }
162
165
  }; // [i18n-Italian]
163
166
 
@@ -159,6 +159,9 @@ const local = {
159
159
  clearSelectAll: 'すべてを選択解除',
160
160
  total: '合計 ${total} アイテム',
161
161
  selected: '選択済み ${total} アイテム'
162
+ },
163
+ Form: {
164
+ optional: '(オプション)'
162
165
  }
163
166
  }; // [i18n-Japan]
164
167
 
@@ -159,6 +159,9 @@ const local = {
159
159
  clearSelectAll: '모두 선택 취소',
160
160
  total: '총 {total} 개 항목',
161
161
  selected: '선택된 {Total} 개 항목'
162
+ },
163
+ Form: {
164
+ optional: '(선택 과목)'
162
165
  }
163
166
  }; // [i18n-Korea]
164
167
 
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Nyahpilih semua',
159
159
  total: 'Jumlah ${total} item',
160
160
  selected: '${total} projek dipilih'
161
+ },
162
+ Form: {
163
+ optional: '(pilihan)'
161
164
  }
162
165
  }; // [i18n-Malaysia(MY)]
163
166
 
@@ -166,6 +166,9 @@ const local = {
166
166
  clearSelectAll: 'Cancelar selecionar tudo',
167
167
  total: 'Total de ${total} itens',
168
168
  selected: '${total} itens selecionados'
169
+ },
170
+ Form: {
171
+ optional: '(opcional)'
169
172
  }
170
173
  }; // 葡萄牙语
171
174
 
@@ -161,6 +161,9 @@ const local = {
161
161
  clearSelectAll: 'Снять выделение',
162
162
  total: 'Всего ${total} элементов',
163
163
  selected: 'Выбрано ${total} элементов'
164
+ },
165
+ Form: {
166
+ optional: '(по желанию)'
164
167
  }
165
168
  }; // [i18n-Russia] 俄罗斯语
166
169
 
@@ -162,6 +162,9 @@ const local = {
162
162
  clearSelectAll: 'ยกเลิกการเลือกทั้งหมด',
163
163
  total: 'รวม ${total} รายการ',
164
164
  selected: 'เลือก ${total} รายการ'
165
+ },
166
+ Form: {
167
+ optional: '(ไม่จำเป็น)'
165
168
  }
166
169
  }; // [i18n-Thai]
167
170
 
@@ -161,6 +161,9 @@ const local = {
161
161
  clearSelectAll: 'Tümünün seçimini kaldır',
162
162
  total: 'Toplam ${total} öğe',
163
163
  selected: '${total} öğe seçildi'
164
+ },
165
+ Form: {
166
+ optional: '(isteğe bağlı)'
164
167
  }
165
168
  }; // [i18n-Turkish]
166
169
 
@@ -161,6 +161,9 @@ const local = {
161
161
  clearSelectAll: 'Bỏ chọn tất cả',
162
162
  total: 'Tổng số ${total} mặt hàng',
163
163
  selected: '${total} mục được chọn'
164
+ },
165
+ Form: {
166
+ optional: '(không bắt buộc)'
164
167
  }
165
168
  }; // [i18n-Vietnam] 越南语
166
169
 
@@ -159,6 +159,9 @@ const local = {
159
159
  clearSelectAll: '取消全选',
160
160
  total: '共 ${total} 项',
161
161
  selected: '已选 ${total} 项'
162
+ },
163
+ Form: {
164
+ optional: '(可选)'
162
165
  }
163
166
  }; // 中文
164
167
 
@@ -159,6 +159,9 @@ const local = {
159
159
  clearSelectAll: '取消全選',
160
160
  total: '共 ${total} 項',
161
161
  selected: '已選 ${total} 項'
162
+ },
163
+ Form: {
164
+ optional: '(可選)'
162
165
  }
163
166
  }; // 中文
164
167
 
@@ -164,14 +164,6 @@ class Modal extends _baseComponent.default {
164
164
  let style = styleFromProps;
165
165
  const maskStyle = maskStyleFromProps;
166
166
  const renderFooter = 'footer' in this.props ? footer : this.renderFooter();
167
-
168
- if (this.props.centered) {
169
- style = (0, _assign.default)({
170
- transform: 'translateY(-50%)',
171
- top: '50%'
172
- }, style);
173
- }
174
-
175
167
  let wrapperStyle = {
176
168
  zIndex
177
169
  };
@@ -376,7 +376,10 @@ class ModalContent extends _baseComponent.default {
376
376
  }, this.getMaskElement(), /*#__PURE__*/_react.default.createElement("div", {
377
377
  role: "none",
378
378
  tabIndex: -1,
379
- className: "".concat(_constants.cssClasses.DIALOG, "-wrap"),
379
+ className: (0, _classnames.default)({
380
+ ["".concat(_constants.cssClasses.DIALOG, "-wrap")]: true,
381
+ ["".concat(_constants.cssClasses.DIALOG, "-wrap-center")]: this.props.centered
382
+ }),
380
383
  onClick: maskClosable ? this.onMaskClick : null,
381
384
  onMouseUp: maskClosable ? this.onMaskMouseUp : null
382
385
  }, this.getDialogElement())); // eslint-disable-next-line max-len
@@ -39,6 +39,7 @@ export interface RadioState {
39
39
  addonId?: string;
40
40
  extraId?: string;
41
41
  focusVisible?: boolean;
42
+ checked?: boolean;
42
43
  }
43
44
  export { RadioChangeEvent };
44
45
  declare class Radio extends BaseComponent<RadioProps, RadioState> {
@@ -71,6 +72,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
71
72
  addonId: string;
72
73
  extraId: string;
73
74
  constructor(props: RadioProps);
75
+ componentDidUpdate(prevProps: RadioProps): void;
74
76
  get adapter(): RadioAdapter;
75
77
  isInGroup(): {
76
78
  value?: string | number;
@@ -14,6 +14,10 @@ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
14
14
 
15
15
  var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
16
16
 
17
+ var _isBoolean2 = _interopRequireDefault(require("lodash/isBoolean"));
18
+
19
+ var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
20
+
17
21
  var _noop2 = _interopRequireDefault(require("lodash/noop"));
18
22
 
19
23
  var _react = _interopRequireDefault(require("react"));
@@ -53,6 +57,7 @@ class Radio extends _baseComponent.default {
53
57
  radioGroup.onChange && radioGroup.onChange(e);
54
58
  }
55
59
 
60
+ !('checked' in this.props) && this.foundation.setChecked(e.target.checked);
56
61
  onChange && onChange(e);
57
62
  };
58
63
 
@@ -77,12 +82,23 @@ class Radio extends _baseComponent.default {
77
82
  this.state = {
78
83
  hover: false,
79
84
  addonId: props.addonId,
80
- extraId: props.extraId
85
+ extraId: props.extraId,
86
+ checked: props.checked || props.defaultChecked || false
81
87
  };
82
88
  this.foundation = new _radioFoundation.default(this.adapter);
83
89
  this.radioEntity = null;
84
90
  }
85
91
 
92
+ componentDidUpdate(prevProps) {
93
+ if (this.props.checked !== prevProps.checked) {
94
+ if ((0, _isUndefined2.default)(this.props.checked)) {
95
+ this.foundation.setChecked(false);
96
+ } else if ((0, _isBoolean2.default)(this.props.checked)) {
97
+ this.foundation.setChecked(this.props.checked);
98
+ }
99
+ }
100
+ }
101
+
86
102
  get adapter() {
87
103
  return (0, _assign.default)((0, _assign.default)({}, super.adapter), {
88
104
  setHover: hover => {
@@ -97,6 +113,11 @@ class Radio extends _baseComponent.default {
97
113
  })
98
114
  });
99
115
  },
116
+ setChecked: checked => {
117
+ this.setState({
118
+ checked
119
+ });
120
+ },
100
121
  setExtraId: () => {
101
122
  this.setState({
102
123
  extraId: (0, _uuid.getUuidShort)({
@@ -131,7 +152,6 @@ class Radio extends _baseComponent.default {
131
152
  const {
132
153
  addonClassName,
133
154
  addonStyle,
134
- checked,
135
155
  disabled,
136
156
  style,
137
157
  className,
@@ -149,9 +169,13 @@ class Radio extends _baseComponent.default {
149
169
  hover: isHover,
150
170
  addonId,
151
171
  extraId,
152
- focusVisible
172
+ focusVisible,
173
+ checked
153
174
  } = this.state;
154
- let props = {};
175
+ const props = {
176
+ checked,
177
+ disabled
178
+ };
155
179
 
156
180
  if (this.isInGroup()) {
157
181
  realChecked = this.context.radioGroup.value === propValue;
@@ -162,16 +186,17 @@ class Radio extends _baseComponent.default {
162
186
  isPureCardRadioGroup = this.context.radioGroup.isPureCardRadio;
163
187
  buttonSize = this.context.radioGroup.buttonSize;
164
188
  realPrefixCls = prefixCls || this.context.radioGroup.prefixCls;
165
- props = {
166
- checked: realChecked,
167
- disabled: isDisabled
168
- };
189
+ props.checked = realChecked;
190
+ props.disabled = isDisabled;
169
191
  } else {
170
192
  realChecked = checked;
171
193
  isDisabled = disabled;
172
194
  realMode = mode;
173
195
  isButtonRadioComponent = type === 'button';
174
196
  realPrefixCls = prefixCls;
197
+ isButtonRadioGroup = type === _constants.strings.TYPE_BUTTON;
198
+ isPureCardRadioGroup = type === _constants.strings.TYPE_PURECARD;
199
+ isCardRadioGroup = type === _constants.strings.TYPE_CARD || isPureCardRadioGroup;
175
200
  }
176
201
 
177
202
  const isButtonRadio = typeof isButtonRadioGroup === 'undefined' ? isButtonRadioComponent : isButtonRadioGroup;
@@ -179,12 +179,14 @@ function ColumnFilter() {
179
179
  } else {
180
180
  iconElem = /*#__PURE__*/_react.default.createElement("div", {
181
181
  className: finalCls
182
- }, /*#__PURE__*/_react.default.createElement(_semiIcons.IconFilter, {
182
+ }, '\u200b'
183
+ /* ZWSP(zero-width space) */
184
+ , /*#__PURE__*/_react.default.createElement(_semiIcons.IconFilter, {
183
185
  role: "button",
184
186
  "aria-label": "Filter data with this column",
185
187
  "aria-haspopup": "listbox",
186
188
  tabIndex: -1,
187
- size: "small"
189
+ size: "default"
188
190
  }));
189
191
  }
190
192
 
@@ -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: {
@@ -40,9 +40,10 @@ class ColumnSorter extends _react.PureComponent {
40
40
  prefixCls,
41
41
  onClick,
42
42
  sortOrder,
43
- style
43
+ style,
44
+ title
44
45
  } = this.props;
45
- const iconBtnSize = 'small';
46
+ const iconBtnSize = 'default';
46
47
  const upCls = (0, _classnames.default)("".concat(prefixCls, "-column-sorter-up"), {
47
48
  on: sortOrder === _constants.strings.SORT_DIRECTIONS[0]
48
49
  });
@@ -61,11 +62,13 @@ class ColumnSorter extends _react.PureComponent {
61
62
  role: 'button'
62
63
  }, ariaProps, {
63
64
  tabIndex: -1,
64
- style: style,
65
- className: "".concat(prefixCls, "-column-sorter"),
65
+ className: "".concat(prefixCls, "-column-sorter-wrapper"),
66
66
  onClick: onClick,
67
67
  onKeyPress: e => (0, _isEnterPress.default)(e) && onClick(e)
68
- }), /*#__PURE__*/_react.default.createElement("span", {
68
+ }), title, /*#__PURE__*/_react.default.createElement("div", {
69
+ style: style,
70
+ className: "".concat(prefixCls, "-column-sorter")
71
+ }, /*#__PURE__*/_react.default.createElement("span", {
69
72
  className: "".concat(upCls)
70
73
  }, /*#__PURE__*/_react.default.createElement(_semiIcons.IconCaretup, {
71
74
  size: iconBtnSize
@@ -73,7 +76,7 @@ class ColumnSorter extends _react.PureComponent {
73
76
  className: "".concat(downCls)
74
77
  }, /*#__PURE__*/_react.default.createElement(_semiIcons.IconCaretdown, {
75
78
  size: iconBtnSize
76
- })));
79
+ }))));
77
80
  }
78
81
 
79
82
  }
@@ -555,15 +555,24 @@ class Table extends _baseComponent.default {
555
555
  const defaultSortOrder = (0, _get2.default)(curQuery, 'defaultSortOrder', false);
556
556
  const sortOrder = _this.foundation.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
557
557
 
558
+ const TitleNode = typeof rawTitle !== 'function' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
559
+ key: _constants.strings.DEFAULT_KEY_COLUMN_TITLE
560
+ }, rawTitle);
561
+
558
562
  if (typeof column.sorter === 'function' || column.sorter === true) {
563
+ // In order to increase the click hot area of ​​sorting, when sorting is required & useFullRender is false,
564
+ // both the title and sorting areas are used as the click hot area for sorting。
559
565
  const sorter = /*#__PURE__*/_react.default.createElement(_ColumnSorter.default, {
560
566
  key: _constants.strings.DEFAULT_KEY_COLUMN_SORTER,
561
567
  sortOrder: sortOrder,
562
- onClick: e => _this.foundation.handleSort(column, e)
568
+ onClick: e => _this.foundation.handleSort(column, e),
569
+ title: TitleNode
563
570
  });
564
571
 
565
572
  useFullRender && (titleMap.sorter = sorter);
566
573
  titleArr.push(sorter);
574
+ } else {
575
+ titleArr.push(TitleNode);
567
576
  }
568
577
 
569
578
  const stateFilteredValue = (0, _get2.default)(curQuery, 'filteredValue');
@@ -583,9 +592,7 @@ class Table extends _baseComponent.default {
583
592
  titleArr.push(filter);
584
593
  }
585
594
 
586
- const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : titleArr.unshift( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
587
- key: _constants.strings.DEFAULT_KEY_COLUMN_TITLE
588
- }, rawTitle)) && titleArr;
595
+ const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : titleArr;
589
596
  column = (0, _assign.default)((0, _assign.default)({}, column), {
590
597
  title: newTitle
591
598
  });
@@ -14,6 +14,7 @@ export interface TagGroupProps<T> {
14
14
  popoverProps?: PopoverProps;
15
15
  avatarShape?: AvatarShape;
16
16
  mode?: string;
17
+ onTagClose: (tagChildren: React.ReactNode, event: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
17
18
  }
18
19
  export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
19
20
  static defaultProps: {
@@ -21,6 +22,7 @@ export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
21
22
  className: string;
22
23
  size: string;
23
24
  avatarShape: string;
25
+ onTagClose: () => any;
24
26
  };
25
27
  static propTypes: {
26
28
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -31,6 +33,7 @@ export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
31
33
  tagList: PropTypes.Requireable<any[]>;
32
34
  size: PropTypes.Requireable<string>;
33
35
  mode: PropTypes.Requireable<string>;
36
+ onTagClose: PropTypes.Requireable<(...args: any[]) => any>;
34
37
  showPopover: PropTypes.Requireable<boolean>;
35
38
  popoverProps: PropTypes.Requireable<object>;
36
39
  avatarShape: PropTypes.Requireable<string>;