@douyinfe/semi-ui 2.17.1 → 2.18.1-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 (212) 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 +1 -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 +133 -28
  13. package/dist/css/semi.min.css +1 -1
  14. package/dist/umd/semi-ui.js +7478 -8726
  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/baseForm.tsx +0 -1
  21. package/form/hoc/withField.tsx +1 -0
  22. package/form/label.tsx +21 -7
  23. package/gulpfile.js +3 -1
  24. package/lib/cjs/_base/base.css +35 -0
  25. package/lib/cjs/anchor/index.js +2 -1
  26. package/lib/cjs/anchor/link.d.ts +1 -1
  27. package/lib/cjs/anchor/link.js +9 -5
  28. package/lib/cjs/autoComplete/index.d.ts +1 -1
  29. package/lib/cjs/autoComplete/index.js +1 -1
  30. package/lib/cjs/autoComplete/option.d.ts +50 -0
  31. package/lib/cjs/autoComplete/option.js +218 -0
  32. package/lib/cjs/button/Button.d.ts +1 -1
  33. package/lib/cjs/button/index.d.ts +1 -1
  34. package/lib/cjs/calendar/index.d.ts +2 -0
  35. package/lib/cjs/calendar/index.js +3 -1
  36. package/lib/cjs/calendar/interface.d.ts +2 -1
  37. package/lib/cjs/carousel/CarouselIndicator.d.ts +1 -1
  38. package/lib/cjs/carousel/index.d.ts +1 -1
  39. package/lib/cjs/carousel/index.js +2 -2
  40. package/lib/cjs/checkbox/checkbox.d.ts +4 -0
  41. package/lib/cjs/checkbox/checkbox.js +9 -3
  42. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  43. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  44. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  45. package/lib/cjs/form/baseForm.js +0 -1
  46. package/lib/cjs/form/hoc/withField.js +2 -1
  47. package/lib/cjs/form/label.d.ts +8 -5
  48. package/lib/cjs/form/label.js +15 -4
  49. package/lib/cjs/locale/interface.d.ts +3 -0
  50. package/lib/cjs/locale/source/ar.js +3 -0
  51. package/lib/cjs/locale/source/de.js +3 -0
  52. package/lib/cjs/locale/source/en_GB.js +3 -0
  53. package/lib/cjs/locale/source/en_US.js +3 -0
  54. package/lib/cjs/locale/source/es.js +3 -0
  55. package/lib/cjs/locale/source/fr.js +3 -0
  56. package/lib/cjs/locale/source/id_ID.js +3 -0
  57. package/lib/cjs/locale/source/it.js +3 -0
  58. package/lib/cjs/locale/source/ja_JP.js +3 -0
  59. package/lib/cjs/locale/source/ko_KR.js +3 -0
  60. package/lib/cjs/locale/source/ms_MY.js +3 -0
  61. package/lib/cjs/locale/source/pt_BR.js +3 -0
  62. package/lib/cjs/locale/source/ru_RU.js +3 -0
  63. package/lib/cjs/locale/source/th_TH.js +3 -0
  64. package/lib/cjs/locale/source/tr_TR.js +3 -0
  65. package/lib/cjs/locale/source/vi_VN.js +3 -0
  66. package/lib/cjs/locale/source/zh_CN.js +3 -0
  67. package/lib/cjs/locale/source/zh_TW.js +3 -0
  68. package/lib/cjs/modal/Modal.js +0 -8
  69. package/lib/cjs/modal/ModalContent.js +4 -1
  70. package/lib/cjs/radio/radio.d.ts +3 -1
  71. package/lib/cjs/radio/radio.js +33 -8
  72. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  73. package/lib/cjs/table/ColumnFilter.js +4 -2
  74. package/lib/cjs/table/ColumnSorter.d.ts +1 -0
  75. package/lib/cjs/table/ColumnSorter.js +9 -6
  76. package/lib/cjs/table/Table.js +11 -4
  77. package/lib/cjs/tabs/TabBar.js +5 -1
  78. package/lib/cjs/tag/group.d.ts +3 -0
  79. package/lib/cjs/tag/group.js +24 -6
  80. package/lib/cjs/tag/index.d.ts +2 -1
  81. package/lib/cjs/tag/index.js +7 -5
  82. package/lib/cjs/tag/interface.d.ts +2 -1
  83. package/lib/cjs/timePicker/TimePicker.d.ts +2 -2
  84. package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
  85. package/lib/cjs/timePicker/index.d.ts +2 -2
  86. package/lib/cjs/transfer/index.js +7 -2
  87. package/lib/cjs/tree/index.d.ts +3 -1
  88. package/lib/cjs/tree/index.js +23 -0
  89. package/lib/cjs/tree/interface.d.ts +4 -0
  90. package/lib/cjs/typography/base.d.ts +1 -1
  91. package/lib/cjs/typography/paragraph.d.ts +1 -1
  92. package/lib/cjs/typography/text.d.ts +1 -1
  93. package/lib/cjs/typography/title.d.ts +2 -2
  94. package/lib/cjs/upload/index.d.ts +1 -1
  95. package/lib/es/_base/base.css +35 -0
  96. package/lib/es/anchor/index.js +2 -1
  97. package/lib/es/anchor/link.d.ts +1 -1
  98. package/lib/es/anchor/link.js +9 -5
  99. package/lib/es/autoComplete/index.d.ts +1 -1
  100. package/lib/es/autoComplete/index.js +1 -1
  101. package/lib/es/autoComplete/option.d.ts +50 -0
  102. package/lib/es/autoComplete/option.js +188 -0
  103. package/lib/es/button/Button.d.ts +1 -1
  104. package/lib/es/button/index.d.ts +1 -1
  105. package/lib/es/calendar/index.d.ts +2 -0
  106. package/lib/es/calendar/index.js +3 -1
  107. package/lib/es/calendar/interface.d.ts +2 -1
  108. package/lib/es/carousel/CarouselIndicator.d.ts +1 -1
  109. package/lib/es/carousel/index.d.ts +1 -1
  110. package/lib/es/carousel/index.js +2 -2
  111. package/lib/es/checkbox/checkbox.d.ts +4 -0
  112. package/lib/es/checkbox/checkbox.js +10 -4
  113. package/lib/es/datePicker/dateInput.d.ts +1 -1
  114. package/lib/es/datePicker/datePicker.d.ts +1 -1
  115. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  116. package/lib/es/form/baseForm.js +0 -1
  117. package/lib/es/form/hoc/withField.js +2 -1
  118. package/lib/es/form/label.d.ts +8 -5
  119. package/lib/es/form/label.js +13 -4
  120. package/lib/es/locale/interface.d.ts +3 -0
  121. package/lib/es/locale/source/ar.js +3 -0
  122. package/lib/es/locale/source/de.js +3 -0
  123. package/lib/es/locale/source/en_GB.js +3 -0
  124. package/lib/es/locale/source/en_US.js +3 -0
  125. package/lib/es/locale/source/es.js +3 -0
  126. package/lib/es/locale/source/fr.js +3 -0
  127. package/lib/es/locale/source/id_ID.js +3 -0
  128. package/lib/es/locale/source/it.js +3 -0
  129. package/lib/es/locale/source/ja_JP.js +3 -0
  130. package/lib/es/locale/source/ko_KR.js +3 -0
  131. package/lib/es/locale/source/ms_MY.js +3 -0
  132. package/lib/es/locale/source/pt_BR.js +3 -0
  133. package/lib/es/locale/source/ru_RU.js +3 -0
  134. package/lib/es/locale/source/th_TH.js +3 -0
  135. package/lib/es/locale/source/tr_TR.js +3 -0
  136. package/lib/es/locale/source/vi_VN.js +3 -0
  137. package/lib/es/locale/source/zh_CN.js +3 -0
  138. package/lib/es/locale/source/zh_TW.js +3 -0
  139. package/lib/es/modal/Modal.js +0 -8
  140. package/lib/es/modal/ModalContent.js +4 -1
  141. package/lib/es/radio/radio.d.ts +3 -1
  142. package/lib/es/radio/radio.js +31 -8
  143. package/lib/es/radio/radioGroup.d.ts +1 -1
  144. package/lib/es/table/ColumnFilter.js +4 -2
  145. package/lib/es/table/ColumnSorter.d.ts +1 -0
  146. package/lib/es/table/ColumnSorter.js +9 -6
  147. package/lib/es/table/Table.js +10 -4
  148. package/lib/es/tabs/TabBar.js +5 -1
  149. package/lib/es/tag/group.d.ts +3 -0
  150. package/lib/es/tag/group.js +24 -6
  151. package/lib/es/tag/index.d.ts +2 -1
  152. package/lib/es/tag/index.js +7 -5
  153. package/lib/es/tag/interface.d.ts +2 -1
  154. package/lib/es/timePicker/TimePicker.d.ts +2 -2
  155. package/lib/es/timePicker/TimeShape.d.ts +1 -1
  156. package/lib/es/timePicker/index.d.ts +2 -2
  157. package/lib/es/transfer/index.js +7 -2
  158. package/lib/es/tree/index.d.ts +3 -1
  159. package/lib/es/tree/index.js +22 -0
  160. package/lib/es/tree/interface.d.ts +4 -0
  161. package/lib/es/typography/base.d.ts +1 -1
  162. package/lib/es/typography/paragraph.d.ts +1 -1
  163. package/lib/es/typography/text.d.ts +1 -1
  164. package/lib/es/typography/title.d.ts +2 -2
  165. package/lib/es/upload/index.d.ts +1 -1
  166. package/locale/interface.ts +3 -0
  167. package/locale/source/ar.ts +3 -0
  168. package/locale/source/de.ts +3 -0
  169. package/locale/source/en_GB.ts +3 -0
  170. package/locale/source/en_US.ts +3 -0
  171. package/locale/source/es.ts +3 -0
  172. package/locale/source/fr.ts +3 -0
  173. package/locale/source/id_ID.ts +3 -0
  174. package/locale/source/it.ts +3 -0
  175. package/locale/source/ja_JP.ts +3 -0
  176. package/locale/source/ko_KR.ts +3 -0
  177. package/locale/source/ms_MY.ts +3 -0
  178. package/locale/source/pt_BR.ts +3 -0
  179. package/locale/source/ru_RU.ts +3 -0
  180. package/locale/source/th_TH.ts +3 -0
  181. package/locale/source/tr_TR.ts +4 -1
  182. package/locale/source/vi_VN.ts +3 -0
  183. package/locale/source/zh_CN.ts +3 -0
  184. package/locale/source/zh_TW.ts +3 -0
  185. package/modal/Modal.tsx +0 -6
  186. package/modal/ModalContent.tsx +4 -1
  187. package/modal/__test__/modal.test.js +1 -1
  188. package/modal/_story/__snapshots__/modal.stories.tsx.snap +203 -0
  189. package/package.json +7 -7
  190. package/radio/_story/radio.stories.js +2 -2
  191. package/radio/radio.tsx +27 -5
  192. package/rating/__test__/rating.test.js +1 -1
  193. package/select/__test__/select.test.js +11 -17
  194. package/select/_story/select.stories.js +6 -6
  195. package/steps/_story/steps.stories.js +3 -3
  196. package/switch/_story/switch.stories.js +4 -4
  197. package/switch/_story/switch.stories.tsx +4 -4
  198. package/table/ColumnFilter.tsx +2 -1
  199. package/table/ColumnSorter.tsx +16 -10
  200. package/table/Table.tsx +7 -4
  201. package/tabs/TabBar.tsx +7 -1
  202. package/tag/_story/tag.stories.js +57 -1
  203. package/tag/group.tsx +20 -3
  204. package/tag/index.tsx +6 -5
  205. package/tag/interface.ts +2 -1
  206. package/transfer/_story/transfer.stories.js +2 -2
  207. package/transfer/index.tsx +7 -2
  208. package/tree/_story/tree.stories.js +152 -3
  209. package/tree/index.tsx +16 -1
  210. package/tree/interface.ts +6 -0
  211. package/upload/_story/upload.stories.js +2 -2
  212. package/webpack.config.js +13 -3
@@ -2,6 +2,7 @@ import _isFunction from "lodash/isFunction";
2
2
  import _get from "lodash/get";
3
3
  import _isEqual from "lodash/isEqual";
4
4
  import _isEmpty from "lodash/isEmpty";
5
+ import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
5
6
  import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
6
7
  import _Set from "@babel/runtime-corejs3/core-js-stable/set";
7
8
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
@@ -40,6 +41,25 @@ class Tree extends BaseComponent {
40
41
  this.foundation.handleInputChange(value);
41
42
  };
42
43
 
44
+ this.scrollTo = scrollData => {
45
+ var _a;
46
+
47
+ const {
48
+ key,
49
+ align = 'center'
50
+ } = scrollData;
51
+ const {
52
+ flattenNodes
53
+ } = this.state;
54
+
55
+ if (key) {
56
+ const index = flattenNodes === null || flattenNodes === void 0 ? void 0 : _findIndexInstanceProperty(flattenNodes).call(flattenNodes, node => {
57
+ return node.key === key;
58
+ });
59
+ index >= 0 && ((_a = this.virtualizedListRef.current) === null || _a === void 0 ? void 0 : _a.scrollToItem(index, align));
60
+ }
61
+ };
62
+
43
63
  this.renderEmpty = () => {
44
64
  const {
45
65
  emptyContent
@@ -201,6 +221,7 @@ class Tree extends BaseComponent {
201
221
  this.optionsRef = /*#__PURE__*/React.createRef();
202
222
  this.foundation = new TreeFoundation(this.adapter);
203
223
  this.dragNode = null;
224
+ this.virtualizedListRef = /*#__PURE__*/React.createRef();
204
225
  }
205
226
  /**
206
227
  * Process of getDerivedStateFromProps was inspired by rc-tree
@@ -573,6 +594,7 @@ class Tree extends BaseComponent {
573
594
  width
574
595
  } = _ref4;
575
596
  return /*#__PURE__*/React.createElement(VirtualList, {
597
+ ref: this.virtualizedListRef,
576
598
  itemCount: flattenNodes.length,
577
599
  itemSize: virtualize.itemSize,
578
600
  height: height,
@@ -118,3 +118,7 @@ export interface NodeListState {
118
118
  cachedMotionKeys?: Set<string>;
119
119
  cachedData?: FlattenNode[];
120
120
  }
121
+ export interface ScrollData {
122
+ key: string;
123
+ align?: 'center' | 'start' | 'end' | 'smart' | 'auto';
124
+ }
@@ -64,7 +64,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
64
64
  spacing: PropTypes.Requireable<"normal" | "extended">;
65
65
  strong: PropTypes.Requireable<boolean>;
66
66
  size: PropTypes.Requireable<"small" | "normal">;
67
- type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
67
+ type: PropTypes.Requireable<"warning" | "success" | "primary" | "secondary" | "tertiary" | "danger" | "quaternary">;
68
68
  style: PropTypes.Requireable<object>;
69
69
  className: PropTypes.Requireable<string>;
70
70
  icon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -29,7 +29,7 @@ export default class Paragraph extends PureComponent<ParagraphProps> {
29
29
  link: PropTypes.Requireable<boolean | object>;
30
30
  underline: PropTypes.Requireable<boolean>;
31
31
  strong: PropTypes.Requireable<boolean>;
32
- type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
32
+ type: PropTypes.Requireable<"warning" | "success" | "primary" | "secondary" | "tertiary" | "danger" | "quaternary">;
33
33
  size: PropTypes.Requireable<"small" | "normal">;
34
34
  spacing: PropTypes.Requireable<"normal" | "extended">;
35
35
  style: PropTypes.Requireable<object>;
@@ -32,7 +32,7 @@ export default class Text extends PureComponent<TextProps> {
32
32
  underline: PropTypes.Requireable<boolean>;
33
33
  link: PropTypes.Requireable<boolean | object>;
34
34
  strong: PropTypes.Requireable<boolean>;
35
- type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
35
+ type: PropTypes.Requireable<"warning" | "success" | "primary" | "secondary" | "tertiary" | "danger" | "quaternary">;
36
36
  size: PropTypes.Requireable<"small" | "normal">;
37
37
  style: PropTypes.Requireable<object>;
38
38
  className: PropTypes.Requireable<string>;
@@ -36,8 +36,8 @@ export default class Title extends PureComponent<TitleProps> {
36
36
  link: PropTypes.Requireable<boolean | object>;
37
37
  underline: PropTypes.Requireable<boolean>;
38
38
  strong: PropTypes.Requireable<boolean>;
39
- type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
40
- heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 5 | 6>;
39
+ type: PropTypes.Requireable<"warning" | "success" | "primary" | "secondary" | "tertiary" | "danger" | "quaternary">;
40
+ heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 6 | 5>;
41
41
  style: PropTypes.Requireable<object>;
42
42
  className: PropTypes.Requireable<string>;
43
43
  component: PropTypes.Requireable<string>;
@@ -140,7 +140,7 @@ declare class Upload extends BaseComponent<UploadProps, UploadState> {
140
140
  style: PropTypes.Requireable<object>;
141
141
  timeout: PropTypes.Requireable<number>;
142
142
  transformFile: PropTypes.Requireable<(...args: any[]) => any>;
143
- uploadTrigger: PropTypes.Requireable<"auto" | "custom">;
143
+ uploadTrigger: PropTypes.Requireable<"custom" | "auto">;
144
144
  validateMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
145
145
  validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
146
146
  withCredentials: PropTypes.Requireable<boolean>;
@@ -149,4 +149,7 @@ export interface Locale {
149
149
  total: string;
150
150
  selected: string;
151
151
  };
152
+ Form: {
153
+ optional: string;
154
+ }
152
155
  }
@@ -150,6 +150,9 @@ const local: Locale = {
150
150
  total: 'مجموع ${total} العناصر',
151
151
  selected: '${total} العناصر المحدد',
152
152
  },
153
+ Form: {
154
+ optional: '(اختياري)',
155
+ },
153
156
  };
154
157
 
155
158
  // [i18n-Arabic]
@@ -150,6 +150,9 @@ const local: Locale = {
150
150
  total: 'Gesamt ${total} Artikel',
151
151
  selected: '${total} ausgewählte Artikel',
152
152
  },
153
+ Form: {
154
+ optional: '(Optional)',
155
+ },
153
156
  };
154
157
 
155
158
  // [i18n-German]
@@ -150,6 +150,9 @@ const local: Locale = {
150
150
  total: 'Total ${total} items',
151
151
  selected: '${total} items selected',
152
152
  },
153
+ Form: {
154
+ optional: '(optional)',
155
+ },
153
156
  };
154
157
 
155
158
  // [i18n-English(GB)]
@@ -150,6 +150,9 @@ const local: Locale = {
150
150
  total: 'Total ${total} items',
151
151
  selected: '${total} items selected',
152
152
  },
153
+ Form: {
154
+ optional: '(optional)',
155
+ },
153
156
  };
154
157
 
155
158
  // [i18n-English(US)]
@@ -155,6 +155,9 @@ const locale: Locale = {
155
155
  total: 'Total ${total} objetos',
156
156
  selected: '${total} objetos seleccionados',
157
157
  },
158
+ Form: {
159
+ optional: '(opcional)',
160
+ },
158
161
  };
159
162
 
160
163
  export default locale;
@@ -150,6 +150,9 @@ const local: Locale = {
150
150
  total: 'Totale ${total} articles',
151
151
  selected: '${total} articles sélectionnés',
152
152
  },
153
+ Form: {
154
+ optional: '(optionnel)',
155
+ },
153
156
  };
154
157
 
155
158
  // [i18n-French]
@@ -150,6 +150,9 @@ const local: Locale = {
150
150
  total: 'Total ${total} proyek',
151
151
  selected: '${total} item dipilih',
152
152
  },
153
+ Form: {
154
+ optional: '(opsional)',
155
+ },
153
156
  };
154
157
 
155
158
  // [i18n-Indonesia(ID)]
@@ -150,6 +150,9 @@ const local: Locale = {
150
150
  total: 'Totale ${total} elementi',
151
151
  selected: '${total} elementi selezionati',
152
152
  },
153
+ Form: {
154
+ optional: '(opzionale)',
155
+ },
153
156
  };
154
157
 
155
158
  // [i18n-Italian]
@@ -151,6 +151,9 @@ const local: Locale = {
151
151
  total: '合計 ${total} アイテム',
152
152
  selected: '選択済み ${total} アイテム',
153
153
  },
154
+ Form: {
155
+ optional: '(オプション)',
156
+ },
154
157
  };
155
158
 
156
159
  // [i18n-Japan]
@@ -151,6 +151,9 @@ const local: Locale = {
151
151
  total: '총 {total} 개 항목',
152
152
  selected: '선택된 {Total} 개 항목',
153
153
  },
154
+ Form: {
155
+ optional: '(선택 과목)',
156
+ },
154
157
  };
155
158
 
156
159
  // [i18n-Korea]
@@ -150,6 +150,9 @@ const local: Locale = {
150
150
  total: 'Jumlah ${total} item',
151
151
  selected: '${total} projek dipilih',
152
152
  },
153
+ Form: {
154
+ optional: '(pilihan)',
155
+ },
153
156
  };
154
157
 
155
158
  // [i18n-Malaysia(MY)]
@@ -158,6 +158,9 @@ const local: Locale = {
158
158
  total: 'Total de ${total} itens',
159
159
  selected: '${total} itens selecionados',
160
160
  },
161
+ Form: {
162
+ optional: '(opcional)',
163
+ },
161
164
  };
162
165
 
163
166
  // 葡萄牙语
@@ -153,6 +153,9 @@ const local: Locale = {
153
153
  total: 'Всего ${total} элементов',
154
154
  selected: 'Выбрано ${total} элементов',
155
155
  },
156
+ Form: {
157
+ optional: '(по желанию)',
158
+ },
156
159
  };
157
160
 
158
161
  // [i18n-Russia] 俄罗斯语
@@ -154,6 +154,9 @@ const local: Locale = {
154
154
  total: 'รวม ${total} รายการ',
155
155
  selected: 'เลือก ${total} รายการ',
156
156
  },
157
+ Form: {
158
+ optional: '(ไม่จำเป็น)',
159
+ },
157
160
  };
158
161
 
159
162
  // [i18n-Thai]
@@ -149,7 +149,10 @@ const local: Locale = {
149
149
  clearSelectAll: 'Tümünün seçimini kaldır',
150
150
  total: 'Toplam ${total} öğe',
151
151
  selected: '${total} öğe seçildi'
152
- }
152
+ },
153
+ Form: {
154
+ optional: '(isteğe bağlı)',
155
+ },
153
156
  };
154
157
 
155
158
  // [i18n-Turkish]
@@ -153,6 +153,9 @@ const local: Locale = {
153
153
  total: 'Tổng số ${total} mặt hàng',
154
154
  selected: '${total} mục được chọn',
155
155
  },
156
+ Form: {
157
+ optional: '(không bắt buộc)',
158
+ },
156
159
  };
157
160
 
158
161
  // [i18n-Vietnam] 越南语
@@ -151,6 +151,9 @@ const local: Locale = {
151
151
  total: '共 ${total} 项',
152
152
  selected: '已选 ${total} 项',
153
153
  },
154
+ Form: {
155
+ optional: '(可选)',
156
+ },
154
157
  };
155
158
 
156
159
  // 中文
@@ -151,6 +151,9 @@ const local: Locale = {
151
151
  total: '共 ${total} 項',
152
152
  selected: '已選 ${total} 項',
153
153
  },
154
+ Form: {
155
+ optional: '(可選)',
156
+ },
154
157
  };
155
158
 
156
159
  // 中文
package/modal/Modal.tsx CHANGED
@@ -347,12 +347,6 @@ class Modal extends BaseComponent<ModalReactProps, ModalState> {
347
347
  let style = styleFromProps;
348
348
  const maskStyle = maskStyleFromProps;
349
349
  const renderFooter = 'footer' in this.props ? footer : this.renderFooter();
350
- if (this.props.centered) {
351
- style = {
352
- transform: 'translateY(-50%)',
353
- top: '50%', ...style,
354
- };
355
- }
356
350
  let wrapperStyle: {
357
351
  zIndex?: CSSProperties['zIndex'];
358
352
  position?: CSSProperties['position'];
@@ -318,7 +318,10 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
318
318
  <div
319
319
  role="none"
320
320
  tabIndex={-1}
321
- className={`${cssClasses.DIALOG}-wrap`}
321
+ className={cls({
322
+ [`${cssClasses.DIALOG}-wrap`]:true,
323
+ [`${cssClasses.DIALOG}-wrap-center`]:this.props.centered
324
+ })}
322
325
  onClick={maskClosable ? this.onMaskClick : null}
323
326
  onMouseUp={maskClosable ? this.onMaskMouseUp : null}
324
327
  >
@@ -287,7 +287,7 @@ describe('modal', () => {
287
287
  it('centered without motion', () => {
288
288
  let com = getModal({ centered: true, visible: true, motion: false });
289
289
  let modal = mount(com, { attachTo: document.getElementById('container') });
290
- expect(modal.find(`div.${BASE_CLASS_PREFIX}-modal`)).toHaveStyle({ transform: 'translateY(-50%)', top: '50%' });
290
+ expect(modal.find(`div.${BASE_CLASS_PREFIX}-modal-wrap`)).toHaveClassName(`${BASE_CLASS_PREFIX}-modal-wrap-center`)
291
291
  });
292
292
 
293
293
  it('keepDOM', () => {
@@ -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.1",
3
+ "version": "2.18.1-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.1",
19
- "@douyinfe/semi-foundation": "2.17.1",
20
- "@douyinfe/semi-icons": "2.17.1",
18
+ "@douyinfe/semi-animation-react": "2.18.1-alpha.0",
19
+ "@douyinfe/semi-foundation": "2.18.1-alpha.0",
20
+ "@douyinfe/semi-icons": "2.18.1-alpha.0",
21
21
  "@douyinfe/semi-illustrations": "2.15.0",
22
- "@douyinfe/semi-theme-default": "2.17.1",
22
+ "@douyinfe/semi-theme-default": "2.18.1-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": "e2dfadcc7f24b9af6cab08b64ac0ead052219961",
69
+ "gitHead": "14883ac99b2f3c772b267d6d6ae5d5412cd3f9de",
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.1",
75
+ "@douyinfe/semi-scss-compile": "2.18.1-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 />