@douyinfe/semi-ui 2.4.1 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/button/index.tsx +1 -1
  2. package/cascader/__test__/cascader.test.js +24 -0
  3. package/cascader/_story/cascader.stories.js +73 -0
  4. package/cascader/index.tsx +5 -2
  5. package/datePicker/_story/v2/FixInputRangeFocus.jsx +25 -0
  6. package/datePicker/_story/v2/index.js +2 -1
  7. package/datePicker/datePicker.tsx +3 -0
  8. package/dist/css/semi.css +56 -29
  9. package/dist/css/semi.min.css +1 -1
  10. package/dist/umd/semi-ui.js +523 -227
  11. package/dist/umd/semi-ui.js.map +1 -1
  12. package/dist/umd/semi-ui.min.js +1 -1
  13. package/dist/umd/semi-ui.min.js.map +1 -1
  14. package/form/__test__/formApi.test.js +182 -0
  15. package/form/_story/FormApi/arrayDemo.jsx +4 -7
  16. package/form/_story/Layout/slotDemo.jsx +2 -2
  17. package/form/_story/demo.jsx +18 -1
  18. package/form/_story/form.stories.js +6 -6
  19. package/form/baseForm.tsx +2 -2
  20. package/lib/cjs/autoComplete/index.d.ts +1 -1
  21. package/lib/cjs/button/Button.d.ts +4 -4
  22. package/lib/cjs/button/buttonGroup.d.ts +2 -2
  23. package/lib/cjs/button/index.d.ts +5 -6
  24. package/lib/cjs/cascader/index.js +6 -0
  25. package/lib/cjs/datePicker/datePicker.js +4 -0
  26. package/lib/cjs/dropdown/index.d.ts +1 -1
  27. package/lib/cjs/form/baseForm.d.ts +1 -1
  28. package/lib/cjs/form/baseForm.js +2 -2
  29. package/lib/cjs/form/field.d.ts +1 -1
  30. package/lib/cjs/iconButton/index.d.ts +2 -2
  31. package/lib/cjs/select/index.d.ts +3 -3
  32. package/lib/cjs/select/index.js +32 -28
  33. package/lib/cjs/select/option.js +2 -2
  34. package/lib/cjs/select/virtualRow.js +2 -2
  35. package/lib/cjs/table/Table.d.ts +1 -1
  36. package/lib/cjs/table/Table.js +8 -2
  37. package/lib/cjs/table/interface.d.ts +1 -0
  38. package/lib/cjs/tabs/interface.d.ts +1 -1
  39. package/lib/cjs/tooltip/index.d.ts +1 -1
  40. package/lib/cjs/tooltip/index.js +12 -4
  41. package/lib/cjs/tree/index.d.ts +2 -0
  42. package/lib/cjs/tree/index.js +15 -8
  43. package/lib/cjs/treeSelect/index.d.ts +2 -0
  44. package/lib/cjs/treeSelect/index.js +64 -27
  45. package/lib/cjs/upload/fileCard.js +31 -22
  46. package/lib/cjs/upload/index.d.ts +6 -0
  47. package/lib/cjs/upload/index.js +15 -8
  48. package/lib/cjs/upload/interface.d.ts +8 -6
  49. package/lib/es/autoComplete/index.d.ts +1 -1
  50. package/lib/es/button/Button.d.ts +4 -4
  51. package/lib/es/button/buttonGroup.d.ts +2 -2
  52. package/lib/es/button/index.d.ts +5 -6
  53. package/lib/es/cascader/index.js +5 -0
  54. package/lib/es/datePicker/datePicker.js +4 -0
  55. package/lib/es/dropdown/index.d.ts +1 -1
  56. package/lib/es/form/baseForm.d.ts +1 -1
  57. package/lib/es/form/baseForm.js +2 -2
  58. package/lib/es/form/field.d.ts +1 -1
  59. package/lib/es/iconButton/index.d.ts +2 -2
  60. package/lib/es/select/index.d.ts +3 -3
  61. package/lib/es/select/index.js +30 -26
  62. package/lib/es/select/option.js +2 -2
  63. package/lib/es/select/virtualRow.js +2 -2
  64. package/lib/es/table/Table.d.ts +1 -1
  65. package/lib/es/table/Table.js +10 -2
  66. package/lib/es/table/interface.d.ts +1 -0
  67. package/lib/es/tabs/interface.d.ts +1 -1
  68. package/lib/es/tooltip/index.d.ts +1 -1
  69. package/lib/es/tooltip/index.js +12 -4
  70. package/lib/es/tree/index.d.ts +2 -0
  71. package/lib/es/tree/index.js +15 -8
  72. package/lib/es/treeSelect/index.d.ts +2 -0
  73. package/lib/es/treeSelect/index.js +64 -27
  74. package/lib/es/upload/fileCard.js +31 -24
  75. package/lib/es/upload/index.d.ts +6 -0
  76. package/lib/es/upload/index.js +14 -8
  77. package/lib/es/upload/interface.d.ts +8 -6
  78. package/package.json +9 -9
  79. package/select/index.tsx +18 -19
  80. package/select/option.tsx +2 -2
  81. package/select/virtualRow.tsx +2 -2
  82. package/table/Table.tsx +7 -2
  83. package/table/_story/Perf/Virtualized/index.jsx +6 -0
  84. package/table/_story/table.stories.js +1 -2
  85. package/table/_story/v2/FixedHeaderMerge/index.jsx +98 -0
  86. package/table/_story/v2/FixedResizable/index.jsx +114 -0
  87. package/table/_story/v2/defaultFilteredValue.tsx +114 -0
  88. package/table/_story/v2/index.js +5 -0
  89. package/table/interface.ts +1 -0
  90. package/tabs/interface.ts +1 -1
  91. package/tooltip/__test__/tooltip.test.js +48 -4
  92. package/tooltip/_story/tooltip.stories.js +718 -559
  93. package/tooltip/index.tsx +6 -6
  94. package/tree/__test__/treeMultiple.test.js +94 -0
  95. package/tree/_story/tree.stories.js +169 -0
  96. package/tree/index.tsx +12 -5
  97. package/treeSelect/__test__/treeMultiple.test.js +94 -0
  98. package/treeSelect/_story/treeSelect.stories.js +242 -0
  99. package/treeSelect/index.tsx +72 -40
  100. package/upload/_story/upload.stories.js +22 -6
  101. package/upload/fileCard.tsx +23 -23
  102. package/upload/index.tsx +15 -6
  103. package/upload/interface.ts +7 -5
@@ -30,7 +30,7 @@ var _semiIcons = require("@douyinfe/semi-icons");
30
30
 
31
31
  var _localeConsumer = _interopRequireDefault(require("../locale/localeConsumer"));
32
32
 
33
- var _index = _interopRequireDefault(require("../iconButton/index"));
33
+ var _index = _interopRequireDefault(require("../button/index"));
34
34
 
35
35
  var _index2 = _interopRequireDefault(require("../progress/index"));
36
36
 
@@ -200,6 +200,7 @@ class FileCard extends _react.PureComponent {
200
200
  onPreviewClick,
201
201
  showPicInfo,
202
202
  renderPicInfo,
203
+ renderPicPreviewIcon,
203
204
  renderThumbnail,
204
205
  name,
205
206
  index
@@ -207,6 +208,7 @@ class FileCard extends _react.PureComponent {
207
208
  const showProgress = status === _constants.strings.FILE_STATUS_UPLOADING && percent !== 100;
208
209
  const showRetry = status === _constants.strings.FILE_STATUS_UPLOAD_FAIL && this.props.showRetry;
209
210
  const showReplace = status === _constants.strings.FILE_STATUS_SUCCESS && this.props.showReplace;
211
+ const showPreview = status === _constants.strings.FILE_STATUS_SUCCESS && !this.props.showReplace;
210
212
  const filePicCardCls = (0, _classnames.default)({
211
213
  ["".concat(prefixCls, "-picture-file-card")]: true,
212
214
  ["".concat(prefixCls, "-picture-file-card-disabled")]: disabled,
@@ -214,7 +216,6 @@ class FileCard extends _react.PureComponent {
214
216
  ["".concat(prefixCls, "-picture-file-card-error")]: status === _constants.strings.FILE_STATUS_UPLOAD_FAIL,
215
217
  ["".concat(prefixCls, "-picture-file-card-uploading")]: showProgress
216
218
  });
217
- const closeCls = "".concat(prefixCls, "-picture-file-card-close");
218
219
 
219
220
  const retry = /*#__PURE__*/_react.default.createElement("div", {
220
221
  role: "button",
@@ -240,6 +241,19 @@ class FileCard extends _react.PureComponent {
240
241
  className: "".concat(prefixCls, "-picture-file-card-icon-replace")
241
242
  })));
242
243
 
244
+ const preview = /*#__PURE__*/_react.default.createElement("div", {
245
+ className: "".concat(prefixCls, "-picture-file-card-preview")
246
+ }, typeof renderPicPreviewIcon === 'function' ? renderPicPreviewIcon(this.props) : null);
247
+
248
+ const close = /*#__PURE__*/_react.default.createElement("div", {
249
+ role: "button",
250
+ tabIndex: 0,
251
+ className: "".concat(prefixCls, "-picture-file-card-close"),
252
+ onClick: e => this.onRemove(e)
253
+ }, /*#__PURE__*/_react.default.createElement(_semiIcons.IconClear, {
254
+ className: "".concat(prefixCls, "-picture-file-card-icon-close")
255
+ }));
256
+
243
257
  const picInfo = typeof renderPicInfo === 'function' ? renderPicInfo(this.props) : /*#__PURE__*/_react.default.createElement("div", {
244
258
  className: "".concat(prefixCls, "-picture-file-card-pic-info")
245
259
  }, index + 1);
@@ -258,14 +272,7 @@ class FileCard extends _react.PureComponent {
258
272
  size: "small",
259
273
  orbitStroke: '#FFF',
260
274
  "aria-label": "uploading file progress"
261
- }) : null, showRetry ? retry : null, showReplace && replace, showPicInfo && picInfo, !disabled && /*#__PURE__*/_react.default.createElement("div", {
262
- className: closeCls,
263
- onClick: e => this.onRemove(e)
264
- }, /*#__PURE__*/_react.default.createElement(_semiIcons.IconClose, {
265
- tabIndex: 0,
266
- role: "button",
267
- size: "extra-small"
268
- })), this.renderPicValidateMsg());
275
+ }) : null, showRetry ? retry : null, showReplace && replace, showPreview && preview, showPicInfo && picInfo, !disabled && close, this.renderPicValidateMsg());
269
276
  }
270
277
 
271
278
  renderFile(locale) {
@@ -280,7 +287,8 @@ class FileCard extends _react.PureComponent {
280
287
  previewFile,
281
288
  status,
282
289
  style,
283
- onPreviewClick
290
+ onPreviewClick,
291
+ renderFileOperation
284
292
  } = this.props;
285
293
  const fileCardCls = (0, _classnames.default)({
286
294
  ["".concat(prefixCls, "-file-card")]: true,
@@ -310,6 +318,14 @@ class FileCard extends _react.PureComponent {
310
318
  previewContent = previewFile(this.props);
311
319
  }
312
320
 
321
+ const operation = typeof renderFileOperation === 'function' ? renderFileOperation(this.props) : /*#__PURE__*/_react.default.createElement(_index.default, {
322
+ onClick: e => this.onRemove(e),
323
+ type: "tertiary",
324
+ icon: /*#__PURE__*/_react.default.createElement(_semiIcons.IconClose, null),
325
+ theme: "borderless",
326
+ size: "small",
327
+ className: closeCls
328
+ });
313
329
  return /*#__PURE__*/_react.default.createElement("div", {
314
330
  role: "listitem",
315
331
  className: fileCardCls,
@@ -352,29 +368,22 @@ class FileCard extends _react.PureComponent {
352
368
  tabIndex: 0,
353
369
  className: "".concat(infoCls, "-retry"),
354
370
  onClick: e => this.onRetry(e)
355
- }, locale.retry) : null)), /*#__PURE__*/_react.default.createElement(_index.default, {
356
- onClick: e => this.onRemove(e),
357
- type: "tertiary",
358
- icon: /*#__PURE__*/_react.default.createElement(_semiIcons.IconClose, null),
359
- theme: "borderless",
360
- size: "small",
361
- className: closeCls
362
- }));
371
+ }, locale.retry) : null)), operation);
363
372
  }
364
373
 
365
374
  onRemove(e) {
366
375
  e.stopPropagation();
367
- this.props.onRemove(this.props, e);
376
+ this.props.onRemove();
368
377
  }
369
378
 
370
379
  onReplace(e) {
371
380
  e.stopPropagation();
372
- this.props.onReplace(this.props, e);
381
+ this.props.onReplace();
373
382
  }
374
383
 
375
384
  onRetry(e) {
376
385
  e.stopPropagation();
377
- this.props.onRetry(this.props, e);
386
+ this.props.onRetry();
378
387
  }
379
388
 
380
389
  render() {
@@ -29,6 +29,7 @@ export interface UploadProps {
29
29
  fileList?: Array<FileItem>;
30
30
  fileName?: string;
31
31
  headers?: Record<string, any> | ((file: File) => Record<string, string>);
32
+ hotSpotLocation?: 'start' | 'end';
32
33
  itemStyle?: CSSProperties;
33
34
  limit?: number;
34
35
  listType?: UploadListType;
@@ -56,6 +57,8 @@ export interface UploadProps {
56
57
  renderFileItem?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
57
58
  renderPicInfo?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
58
59
  renderThumbnail?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
60
+ renderPicPreviewIcon?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
61
+ renderFileOperation?: (fileItem: RenderFileItemProps) => ReactNode;
59
62
  showClear?: boolean;
60
63
  showPicInfo?: boolean;
61
64
  showReplace?: boolean;
@@ -99,6 +102,7 @@ declare class Upload extends BaseComponent<UploadProps, UploadState> {
99
102
  fileList: PropTypes.Requireable<any[]>;
100
103
  fileName: PropTypes.Requireable<string>;
101
104
  headers: PropTypes.Requireable<object>;
105
+ hotSpotLocation: PropTypes.Requireable<string>;
102
106
  itemStyle: PropTypes.Requireable<object>;
103
107
  limit: PropTypes.Requireable<number>;
104
108
  listType: PropTypes.Requireable<"picture" | "list">;
@@ -124,6 +128,8 @@ declare class Upload extends BaseComponent<UploadProps, UploadState> {
124
128
  prompt: PropTypes.Requireable<PropTypes.ReactNodeLike>;
125
129
  promptPosition: PropTypes.Requireable<"left" | "right" | "bottom">;
126
130
  renderFileItem: PropTypes.Requireable<(...args: any[]) => any>;
131
+ renderPicPreviewIcon: PropTypes.Requireable<(...args: any[]) => any>;
132
+ renderFileOperation: PropTypes.Requireable<(...args: any[]) => any>;
127
133
  renderPicInfo: PropTypes.Requireable<(...args: any[]) => any>;
128
134
  renderThumbnail: PropTypes.Requireable<(...args: any[]) => any>;
129
135
  showClear: PropTypes.Requireable<boolean>;
@@ -16,6 +16,8 @@ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
16
16
 
17
17
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
18
18
 
19
+ var _pick2 = _interopRequireDefault(require("lodash/pick"));
20
+
19
21
  var _noop2 = _interopRequireDefault(require("lodash/noop"));
20
22
 
21
23
  var _react = _interopRequireDefault(require("react"));
@@ -136,14 +138,14 @@ class Upload extends _baseComponent.default {
136
138
  previewFile,
137
139
  listType,
138
140
  itemStyle,
139
- showRetry,
140
141
  showPicInfo,
141
142
  renderPicInfo,
143
+ renderPicPreviewIcon,
144
+ renderFileOperation,
142
145
  renderFileItem,
143
146
  renderThumbnail,
144
147
  disabled,
145
- onPreviewClick,
146
- showReplace
148
+ onPreviewClick
147
149
  } = this.props;
148
150
 
149
151
  const onRemove = () => this.remove(file);
@@ -156,20 +158,20 @@ class Upload extends _baseComponent.default {
156
158
  this.replace(index);
157
159
  };
158
160
 
159
- const fileCardProps = (0, _assign.default)((0, _assign.default)({}, file), {
161
+ const fileCardProps = (0, _assign.default)((0, _assign.default)((0, _assign.default)({}, (0, _pick2.default)(this.props, ['showRetry', 'showReplace', ''])), file), {
160
162
  previewFile,
161
163
  listType,
162
164
  onRemove,
163
165
  onRetry,
164
166
  index,
165
167
  key: uid || (0, _concat.default)(_context = "".concat(name)).call(_context, index),
166
- showRetry: typeof file.showRetry !== 'undefined' ? file.showRetry : showRetry,
167
168
  style: itemStyle,
168
169
  disabled,
169
170
  showPicInfo,
170
171
  renderPicInfo,
172
+ renderPicPreviewIcon,
173
+ renderFileOperation,
171
174
  renderThumbnail,
172
- showReplace: typeof file.showReplace !== 'undefined' ? file.showReplace : showReplace,
173
175
  onReplace,
174
176
  onPreviewClick: typeof onPreviewClick !== 'undefined' ? () => this.foundation.handlePreviewClick(file) : undefined
175
177
  });
@@ -211,7 +213,8 @@ class Upload extends _baseComponent.default {
211
213
  limit,
212
214
  disabled,
213
215
  children,
214
- draggable
216
+ draggable,
217
+ hotSpotLocation
215
218
  } = this.props;
216
219
  const {
217
220
  fileList: stateFileList,
@@ -269,7 +272,7 @@ class Upload extends _baseComponent.default {
269
272
  className: mainCls,
270
273
  role: "list",
271
274
  "aria-label": "picture list"
272
- }, (0, _map.default)(fileList).call(fileList, (file, index) => this.renderFile(file, index, locale)), showAddTriggerInList ? addContent : null)));
275
+ }, showAddTriggerInList && hotSpotLocation === 'start' ? addContent : null, (0, _map.default)(fileList).call(fileList, (file, index) => this.renderFile(file, index, locale)), showAddTriggerInList && hotSpotLocation === 'end' ? addContent : null)));
273
276
  };
274
277
 
275
278
  this.renderFileListDefault = () => {
@@ -609,6 +612,7 @@ Upload.propTypes = {
609
612
  fileList: _propTypes.default.array,
610
613
  fileName: _propTypes.default.string,
611
614
  headers: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.func]),
615
+ hotSpotLocation: _propTypes.default.oneOf(['start', 'end']),
612
616
  itemStyle: _propTypes.default.object,
613
617
  limit: _propTypes.default.number,
614
618
  listType: _propTypes.default.oneOf(_constants.strings.LIST_TYPE),
@@ -634,6 +638,8 @@ Upload.propTypes = {
634
638
  prompt: _propTypes.default.node,
635
639
  promptPosition: _propTypes.default.oneOf(_constants.strings.PROMPT_POSITION),
636
640
  renderFileItem: _propTypes.default.func,
641
+ renderPicPreviewIcon: _propTypes.default.func,
642
+ renderFileOperation: _propTypes.default.func,
637
643
  renderPicInfo: _propTypes.default.func,
638
644
  renderThumbnail: _propTypes.default.func,
639
645
  showClear: _propTypes.default.bool,
@@ -653,6 +659,7 @@ Upload.defaultProps = {
653
659
  defaultFileList: [],
654
660
  disabled: false,
655
661
  listType: 'list',
662
+ hotSpotLocation: 'end',
656
663
  multiple: false,
657
664
  onAcceptInvalid: _noop2.default,
658
665
  onChange: _noop2.default,
@@ -1,4 +1,4 @@
1
- import { ReactNode, CSSProperties, MouseEvent } from 'react';
1
+ import { ReactNode, CSSProperties } from 'react';
2
2
  import { BaseFileItem } from '@douyinfe/semi-foundation/lib/cjs/upload/foundation';
3
3
  import { strings } from '@douyinfe/semi-foundation/lib/cjs/upload/constants';
4
4
  import { ArrayElement } from '../_base/base';
@@ -45,14 +45,16 @@ export interface RenderFileItemProps extends FileItem {
45
45
  index?: number;
46
46
  previewFile?: (fileItem: RenderFileItemProps) => ReactNode;
47
47
  listType: UploadListType;
48
- onRemove: (props: RenderFileItemProps, e: MouseEvent) => void;
49
- onRetry: (props: RenderFileItemProps, e: MouseEvent) => void;
50
- onReplace: (props: RenderFileItemProps, e: MouseEvent) => void;
48
+ onRemove: () => void;
49
+ onRetry: () => void;
50
+ onReplace: () => void;
51
51
  key: string;
52
52
  showPicInfo?: boolean;
53
53
  renderPicInfo?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
54
- showRetry: boolean;
55
- showReplace: boolean;
54
+ renderPicPreviewIcon?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
55
+ renderFileOperation?: (fileItem: RenderFileItemProps) => ReactNode;
56
+ showRetry?: boolean;
57
+ showReplace?: boolean;
56
58
  style?: CSSProperties;
57
59
  disabled: boolean;
58
60
  onPreviewClick: () => void;
@@ -113,7 +113,7 @@ declare class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<Au
113
113
  onBlur: PropTypes.Requireable<(...args: any[]) => any>;
114
114
  onFocus: PropTypes.Requireable<(...args: any[]) => any>;
115
115
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
116
- position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
116
+ position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
117
117
  placeholder: PropTypes.Requireable<string>;
118
118
  prefix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
119
119
  onChangeWithObject: PropTypes.Requireable<boolean>;
@@ -46,15 +46,15 @@ export default class Button extends PureComponent<ButtonProps> {
46
46
  disabled: PropTypes.Requireable<boolean>;
47
47
  prefixCls: PropTypes.Requireable<string>;
48
48
  style: PropTypes.Requireable<object>;
49
- size: PropTypes.Requireable<unknown>;
50
- type: PropTypes.Requireable<unknown>;
49
+ size: PropTypes.Requireable<"default" | "small" | "large">;
50
+ type: PropTypes.Requireable<"warning" | "primary" | "tertiary" | "secondary" | "danger">;
51
51
  block: PropTypes.Requireable<boolean>;
52
52
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
53
53
  onMouseDown: PropTypes.Requireable<(...args: any[]) => any>;
54
54
  circle: PropTypes.Requireable<boolean>;
55
55
  loading: PropTypes.Requireable<boolean>;
56
- htmlType: PropTypes.Requireable<unknown>;
57
- theme: PropTypes.Requireable<unknown>;
56
+ htmlType: PropTypes.Requireable<"button" | "reset" | "submit">;
57
+ theme: PropTypes.Requireable<"solid" | "light" | "borderless">;
58
58
  className: PropTypes.Requireable<string>;
59
59
  onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
60
60
  onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
@@ -16,8 +16,8 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
16
16
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
17
17
  disabled: PropTypes.Requireable<boolean>;
18
18
  type: PropTypes.Requireable<string>;
19
- size: PropTypes.Requireable<unknown>;
20
- theme: PropTypes.Requireable<unknown>;
19
+ size: PropTypes.Requireable<"default" | "small" | "large">;
20
+ theme: PropTypes.Requireable<"solid" | "light" | "borderless">;
21
21
  'aria-label': PropTypes.Requireable<string>;
22
22
  };
23
23
  static defaultProps: {
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
- import { ButtonProps as BaseButtonProps } from './Button';
3
2
  import { IconButtonProps } from '../iconButton';
4
3
  export { ButtonProps as BaseButtonProps, HtmlType, Size, Theme, Type } from './Button';
5
4
  export { HorizontalPaddingType } from '../iconButton';
6
5
  export { ButtonGroupProps } from './buttonGroup';
7
6
  export { SplitButtonGroupProps } from './splitButtonGroup';
8
- export interface ButtonProps extends IconButtonProps, BaseButtonProps {
7
+ export interface ButtonProps extends IconButtonProps {
9
8
  }
10
9
  declare class Button extends React.PureComponent<ButtonProps> {
11
10
  static propTypes: {
@@ -18,18 +17,18 @@ declare class Button extends React.PureComponent<ButtonProps> {
18
17
  noHorizontalPadding: import("prop-types").Requireable<string | boolean | any[]>;
19
18
  children: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
20
19
  theme: import("prop-types").Requireable<string>;
21
- iconPosition: import("prop-types").Requireable<unknown>;
20
+ iconPosition: import("prop-types").Requireable<"left" | "right">;
22
21
  className: import("prop-types").Requireable<string>;
23
22
  onMouseEnter: import("prop-types").Requireable<(...args: any[]) => any>;
24
23
  onMouseLeave: import("prop-types").Requireable<(...args: any[]) => any>;
25
24
  disabled: import("prop-types").Requireable<boolean>;
26
- size: import("prop-types").Requireable<unknown>;
27
- type: import("prop-types").Requireable<unknown>;
25
+ size: import("prop-types").Requireable<"default" | "small" | "large">;
26
+ type: import("prop-types").Requireable<"warning" | "primary" | "tertiary" | "secondary" | "danger">;
28
27
  block: import("prop-types").Requireable<boolean>;
29
28
  onClick: import("prop-types").Requireable<(...args: any[]) => any>;
30
29
  onMouseDown: import("prop-types").Requireable<(...args: any[]) => any>;
31
30
  circle: import("prop-types").Requireable<boolean>;
32
- htmlType: import("prop-types").Requireable<unknown>;
31
+ htmlType: import("prop-types").Requireable<"button" | "reset" | "submit">;
33
32
  'aria-label': import("prop-types").Requireable<string>;
34
33
  };
35
34
  constructor(props?: {});
@@ -5,6 +5,7 @@ import _isFunction from "lodash/isFunction";
5
5
  import _isEmpty from "lodash/isEmpty";
6
6
  import _isString from "lodash/isString";
7
7
  import _isEqual from "lodash/isEqual";
8
+ import _isSet from "lodash/isSet";
8
9
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
9
10
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
10
11
  import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
@@ -722,6 +723,10 @@ class Cascader extends BaseComponent {
722
723
  realKeys = formatKeys;
723
724
  }
724
725
 
726
+ if (_isSet(realKeys)) {
727
+ realKeys = [...realKeys];
728
+ }
729
+
725
730
  const calRes = calcCheckedKeys(_flatten(realKeys), keyEntities);
726
731
  const checkedKeys = new _Set(calRes.checkedKeys);
727
732
  const halfCheckedKeys = new _Set(calRes.halfCheckedKeys); // disableStrictly
@@ -401,6 +401,10 @@ export default class DatePicker extends BaseComponent {
401
401
 
402
402
  if (prevProps.open !== this.props.open) {
403
403
  this.foundation.initPanelOpenStatus();
404
+
405
+ if (!this.props.open) {
406
+ this.foundation.clearRangeInputFocus();
407
+ }
404
408
  }
405
409
  }
406
410
 
@@ -58,7 +58,7 @@ declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
58
58
  render: PropTypes.Requireable<PropTypes.ReactNodeLike>;
59
59
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
60
60
  visible: PropTypes.Requireable<boolean>;
61
- position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
61
+ position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
62
62
  getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
63
63
  mouseEnterDelay: PropTypes.Requireable<number>;
64
64
  mouseLeaveDelay: PropTypes.Requireable<number>;
@@ -80,7 +80,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
80
80
  emptyContent?: React.ReactNode;
81
81
  onDropdownVisibleChange?: (visible: boolean) => void;
82
82
  zIndex?: number;
83
- position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver";
83
+ position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
84
84
  onSearch?: (value: string) => void;
85
85
  dropdownClassName?: string;
86
86
  dropdownStyle?: React.CSSProperties;
@@ -77,8 +77,8 @@ class Form extends BaseComponent {
77
77
  notifySubmitFail: (errors, values) => {
78
78
  this.props.onSubmitFail(errors, values);
79
79
  },
80
- forceUpdate: () => {
81
- this.forceUpdate();
80
+ forceUpdate: callback => {
81
+ this.forceUpdate(callback);
82
82
  },
83
83
  notifyChange: formState => {
84
84
  this.props.onChange(formState);
@@ -28,7 +28,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
28
28
  emptyContent?: import("react").ReactNode;
29
29
  onDropdownVisibleChange?: (visible: boolean) => void;
30
30
  zIndex?: number;
31
- position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver";
31
+ position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
32
32
  onSearch?: (value: string) => void;
33
33
  dropdownClassName?: string;
34
34
  dropdownStyle?: import("react").CSSProperties;
@@ -19,7 +19,7 @@ export interface IconButtonProps extends ButtonProps {
19
19
  }
20
20
  declare class IconButton extends PureComponent<IconButtonProps> {
21
21
  static defaultProps: {
22
- iconPosition: any;
22
+ iconPosition: "left";
23
23
  prefixCls: string;
24
24
  loading: boolean;
25
25
  noHorizontalPadding: boolean;
@@ -36,7 +36,7 @@ declare class IconButton extends PureComponent<IconButtonProps> {
36
36
  noHorizontalPadding: PropTypes.Requireable<string | boolean | any[]>;
37
37
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
38
38
  theme: PropTypes.Requireable<string>;
39
- iconPosition: PropTypes.Requireable<unknown>;
39
+ iconPosition: PropTypes.Requireable<"left" | "right">;
40
40
  className: PropTypes.Requireable<string>;
41
41
  onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
42
42
  onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
@@ -165,7 +165,7 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
165
165
  emptyContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
166
166
  onDropdownVisibleChange: PropTypes.Requireable<(...args: any[]) => any>;
167
167
  zIndex: PropTypes.Requireable<number>;
168
- position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
168
+ position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
169
169
  onSearch: PropTypes.Requireable<(...args: any[]) => any>;
170
170
  getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
171
171
  dropdownClassName: PropTypes.Requireable<string>;
@@ -243,8 +243,8 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
243
243
  renderOption(option: OptionProps, optionIndex: number, style?: React.CSSProperties): any;
244
244
  renderCreateOption(option: OptionProps, isFocused: boolean, optionIndex: number, style: React.CSSProperties): JSX.Element;
245
245
  onOptionHover(optionIndex: number): void;
246
- renderWithGroup(visibileOptions: OptionProps[]): JSX.Element[];
247
- renderVirtualizeList(visibileOptions: OptionProps[]): JSX.Element;
246
+ renderWithGroup(visibleOptions: OptionProps[]): JSX.Element[];
247
+ renderVirtualizeList(visibleOptions: OptionProps[]): JSX.Element;
248
248
  renderOptions(children?: React.ReactNode): JSX.Element;
249
249
  renderSingleSelection(selections: Map<OptionProps['label'], any>, filterable: boolean): JSX.Element;
250
250
  renderMultipleSelection(selections: Map<OptionProps['label'], any>, filterable: boolean): JSX.Element;
@@ -285,11 +285,19 @@ class Select extends BaseComponent {
285
285
  el.focus();
286
286
  } catch (error) {}
287
287
  },
288
- updateScrollTop: () => {
289
- var _context9, _context10;
288
+ updateScrollTop: index => {
289
+ var _context10, _context11;
290
290
 
291
291
  // eslint-disable-next-line max-len
292
- let destNode = document.querySelector(_concatInstanceProperty(_context9 = _concatInstanceProperty(_context10 = "#".concat(prefixcls, "-")).call(_context10, this.selectOptionListID, " .")).call(_context9, prefixcls, "-option-selected"));
292
+ let optionClassName = ".".concat(prefixcls, "-option-selected");
293
+
294
+ if (index !== undefined) {
295
+ var _context9;
296
+
297
+ optionClassName = _concatInstanceProperty(_context9 = ".".concat(prefixcls, "-option:nth-child(")).call(_context9, index, ")");
298
+ }
299
+
300
+ let destNode = document.querySelector(_concatInstanceProperty(_context10 = _concatInstanceProperty(_context11 = "#".concat(prefixcls, "-")).call(_context11, this.selectOptionListID, " ")).call(_context10, optionClassName));
293
301
 
294
302
  if (_Array$isArray(destNode)) {
295
303
  // eslint-disable-next-line prefer-destructuring
@@ -317,11 +325,11 @@ class Select extends BaseComponent {
317
325
  }
318
326
 
319
327
  componentDidUpdate(prevProps, prevState) {
320
- var _context11, _context12;
328
+ var _context12, _context13;
321
329
 
322
- const prevChildrenKeys = _mapInstanceProperty(_context11 = React.Children.toArray(prevProps.children)).call(_context11, child => child.key);
330
+ const prevChildrenKeys = _mapInstanceProperty(_context12 = React.Children.toArray(prevProps.children)).call(_context12, child => child.key);
323
331
 
324
- const nowChildrenKeys = _mapInstanceProperty(_context12 = React.Children.toArray(this.props.children)).call(_context12, child => child.key);
332
+ const nowChildrenKeys = _mapInstanceProperty(_context13 = React.Children.toArray(this.props.children)).call(_context13, child => child.key);
325
333
 
326
334
  let isOptionsChanged = false;
327
335
 
@@ -515,34 +523,30 @@ class Select extends BaseComponent {
515
523
  this.foundation.handleOptionMouseEnter(optionIndex);
516
524
  }
517
525
 
518
- renderWithGroup(visibileOptions) {
526
+ renderWithGroup(visibleOptions) {
519
527
  const content = [];
520
528
  const groupStatus = new _Map();
521
529
 
522
- _forEachInstanceProperty(visibileOptions).call(visibileOptions, (option, optionIndex) => {
530
+ _forEachInstanceProperty(visibleOptions).call(visibleOptions, (option, optionIndex) => {
523
531
  const parentGroup = option._parentGroup;
524
532
  const optionContent = this.renderOption(option, optionIndex);
525
533
 
526
- if (parentGroup && groupStatus.has(parentGroup.label)) {
527
- // group content already insert
528
- content.push(optionContent);
529
- } else if (parentGroup) {
534
+ if (parentGroup && !groupStatus.has(parentGroup.label)) {
535
+ // when use with OptionGroup and group content not already insert
530
536
  const groupContent = /*#__PURE__*/React.createElement(OptionGroup, _Object$assign({}, parentGroup, {
531
537
  key: parentGroup.label
532
538
  }));
533
539
  groupStatus.set(parentGroup.label, true);
534
540
  content.push(groupContent);
535
- content.push(optionContent);
536
- } else {
537
- // when not use with OptionGroup
538
- content.push(optionContent);
539
541
  }
542
+
543
+ content.push(optionContent);
540
544
  });
541
545
 
542
546
  return content;
543
547
  }
544
548
 
545
- renderVirtualizeList(visibileOptions) {
549
+ renderVirtualizeList(visibleOptions) {
546
550
  const {
547
551
  virtualize
548
552
  } = this.props;
@@ -557,10 +561,10 @@ class Select extends BaseComponent {
557
561
  return /*#__PURE__*/React.createElement(List, {
558
562
  ref: this.virtualizeListRef,
559
563
  height: height || numbers.LIST_HEIGHT,
560
- itemCount: visibileOptions.length,
564
+ itemCount: visibleOptions.length,
561
565
  itemSize: itemSize,
562
566
  itemData: {
563
- visibileOptions,
567
+ visibleOptions,
564
568
  renderOption: this.renderOption
565
569
  },
566
570
  width: width || '100%',
@@ -571,7 +575,7 @@ class Select extends BaseComponent {
571
575
  }
572
576
 
573
577
  renderOptions(children) {
574
- var _context13;
578
+ var _context14;
575
579
 
576
580
  const {
577
581
  dropdownMinWidth,
@@ -591,12 +595,12 @@ class Select extends BaseComponent {
591
595
  multiple
592
596
  } = this.props; // Do a filter first, instead of directly judging in forEach, so that the focusIndex can correspond to
593
597
 
594
- const visibileOptions = _filterInstanceProperty(options).call(options, item => item._show);
598
+ const visibleOptions = _filterInstanceProperty(options).call(options, item => item._show);
595
599
 
596
- let listContent = this.renderWithGroup(visibileOptions);
600
+ let listContent = this.renderWithGroup(visibleOptions);
597
601
 
598
602
  if (virtualize) {
599
- listContent = this.renderVirtualizeList(visibileOptions);
603
+ listContent = this.renderVirtualizeList(visibleOptions);
600
604
  }
601
605
 
602
606
  const style = _Object$assign({
@@ -609,7 +613,7 @@ class Select extends BaseComponent {
609
613
  });
610
614
  const isEmpty = !options.length || !_someInstanceProperty(options).call(options, item => item._show);
611
615
  return /*#__PURE__*/React.createElement("div", {
612
- id: _concatInstanceProperty(_context13 = "".concat(prefixcls, "-")).call(_context13, this.selectOptionListID),
616
+ id: _concatInstanceProperty(_context14 = "".concat(prefixcls, "-")).call(_context14, this.selectOptionListID),
613
617
  className: dropdownClassName,
614
618
  style: style
615
619
  }, outerTopSlot, /*#__PURE__*/React.createElement("div", {
@@ -840,7 +844,7 @@ class Select extends BaseComponent {
840
844
  }
841
845
 
842
846
  renderSelection() {
843
- var _context14;
847
+ var _context15;
844
848
 
845
849
  const {
846
850
  disabled,
@@ -924,7 +928,7 @@ class Select extends BaseComponent {
924
928
  role: "combobox",
925
929
  "aria-disabled": disabled,
926
930
  "aria-expanded": isOpen,
927
- "aria-controls": _concatInstanceProperty(_context14 = "".concat(prefixcls, "-")).call(_context14, this.selectOptionListID),
931
+ "aria-controls": _concatInstanceProperty(_context15 = "".concat(prefixcls, "-")).call(_context15, this.selectOptionListID),
928
932
  "aria-haspopup": "listbox",
929
933
  "aria-label": "select value",
930
934
  "aria-invalid": this.props['aria-invalid'],
@@ -36,9 +36,9 @@ class Option extends PureComponent {
36
36
  const {
37
37
  props
38
38
  } = this;
39
- const isDisbled = props.disabled;
39
+ const isDisabled = props.disabled;
40
40
 
41
- if (!isDisbled) {
41
+ if (!isDisabled) {
42
42
  props.onSelect(_Object$assign(_Object$assign({}, rest), {
43
43
  value,
44
44
  label: label || children
@@ -5,9 +5,9 @@ const VirtualRow = _ref => {
5
5
  style
6
6
  } = _ref;
7
7
  const {
8
- visibileOptions
8
+ visibleOptions
9
9
  } = data;
10
- const option = visibileOptions[index];
10
+ const option = visibleOptions[index];
11
11
  return data.renderOption(option, index, style);
12
12
  };
13
13