@douyinfe/semi-ui 2.24.0-beta.1 → 2.24.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 (75) hide show
  1. package/dist/umd/semi-ui.js +778 -305
  2. package/dist/umd/semi-ui.js.map +1 -1
  3. package/dist/umd/semi-ui.min.js +1 -1
  4. package/dist/umd/semi-ui.min.js.map +1 -1
  5. package/lib/cjs/anchor/index.d.ts +1 -1
  6. package/lib/cjs/autoComplete/index.d.ts +1 -1
  7. package/lib/cjs/button/Button.d.ts +2 -2
  8. package/lib/cjs/button/buttonGroup.d.ts +1 -1
  9. package/lib/cjs/button/index.d.ts +2 -2
  10. package/lib/cjs/cascader/index.js +8 -7
  11. package/lib/cjs/cascader/item.d.ts +1 -0
  12. package/lib/cjs/cascader/item.js +7 -5
  13. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  14. package/lib/cjs/datePicker/datePicker.d.ts +2 -2
  15. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  16. package/lib/cjs/datePicker/yearAndMonth.js +16 -6
  17. package/lib/cjs/form/baseForm.d.ts +1 -1
  18. package/lib/cjs/form/field.d.ts +1 -1
  19. package/lib/cjs/image/preview.js +1 -1
  20. package/lib/cjs/input/index.d.ts +3 -1
  21. package/lib/cjs/input/index.js +32 -12
  22. package/lib/cjs/input/inputGroup.d.ts +1 -1
  23. package/lib/cjs/popover/index.d.ts +1 -1
  24. package/lib/cjs/rating/index.d.ts +1 -1
  25. package/lib/cjs/rating/item.d.ts +1 -1
  26. package/lib/cjs/switch/index.d.ts +1 -1
  27. package/lib/cjs/table/Table.d.ts +2 -2
  28. package/lib/cjs/table/index.d.ts +1 -1
  29. package/lib/cjs/tabs/TabBar.js +1 -2
  30. package/lib/cjs/tagInput/index.d.ts +1 -1
  31. package/lib/cjs/timePicker/TimePicker.d.ts +1 -1
  32. package/lib/cjs/timePicker/index.d.ts +1 -1
  33. package/lib/cjs/tooltip/index.d.ts +1 -1
  34. package/lib/cjs/treeSelect/index.js +40 -6
  35. package/lib/cjs/typography/base.d.ts +1 -1
  36. package/lib/cjs/typography/numeral.d.ts +1 -1
  37. package/lib/cjs/typography/paragraph.d.ts +1 -1
  38. package/lib/cjs/typography/text.d.ts +1 -1
  39. package/lib/cjs/typography/title.d.ts +2 -2
  40. package/lib/es/anchor/index.d.ts +1 -1
  41. package/lib/es/autoComplete/index.d.ts +1 -1
  42. package/lib/es/button/Button.d.ts +2 -2
  43. package/lib/es/button/buttonGroup.d.ts +1 -1
  44. package/lib/es/button/index.d.ts +2 -2
  45. package/lib/es/cascader/index.js +6 -4
  46. package/lib/es/cascader/item.d.ts +1 -0
  47. package/lib/es/cascader/item.js +7 -5
  48. package/lib/es/datePicker/dateInput.d.ts +1 -1
  49. package/lib/es/datePicker/datePicker.d.ts +2 -2
  50. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  51. package/lib/es/datePicker/yearAndMonth.js +17 -7
  52. package/lib/es/form/baseForm.d.ts +1 -1
  53. package/lib/es/form/field.d.ts +1 -1
  54. package/lib/es/image/preview.js +1 -1
  55. package/lib/es/input/index.d.ts +3 -1
  56. package/lib/es/input/index.js +31 -12
  57. package/lib/es/input/inputGroup.d.ts +1 -1
  58. package/lib/es/popover/index.d.ts +1 -1
  59. package/lib/es/rating/index.d.ts +1 -1
  60. package/lib/es/rating/item.d.ts +1 -1
  61. package/lib/es/switch/index.d.ts +1 -1
  62. package/lib/es/table/Table.d.ts +2 -2
  63. package/lib/es/table/index.d.ts +1 -1
  64. package/lib/es/tabs/TabBar.js +1 -2
  65. package/lib/es/tagInput/index.d.ts +1 -1
  66. package/lib/es/timePicker/TimePicker.d.ts +1 -1
  67. package/lib/es/timePicker/index.d.ts +1 -1
  68. package/lib/es/tooltip/index.d.ts +1 -1
  69. package/lib/es/treeSelect/index.js +40 -6
  70. package/lib/es/typography/base.d.ts +1 -1
  71. package/lib/es/typography/numeral.d.ts +1 -1
  72. package/lib/es/typography/paragraph.d.ts +1 -1
  73. package/lib/es/typography/text.d.ts +1 -1
  74. package/lib/es/typography/title.d.ts +2 -2
  75. package/package.json +8 -8
@@ -541,7 +541,9 @@ class TreeSelect extends BaseComponent {
541
541
  maxTagCount,
542
542
  checkRelation,
543
543
  showRestTagsPopover,
544
- restTagsPopoverProps
544
+ restTagsPopoverProps,
545
+ searchPosition,
546
+ filterTreeNode
545
547
  } = this.props;
546
548
  const {
547
549
  keyEntities,
@@ -555,8 +557,16 @@ class TreeSelect extends BaseComponent {
555
557
  keyList = normalizeKeyList(checkedKeys, keyEntities, leafOnly);
556
558
  } else if (checkRelation === 'unRelated') {
557
559
  keyList = [...realCheckedKeys];
558
- }
560
+ } // auto focus search input divide into two parts
561
+ // 1. filterTreeNode && searchPosition === strings.SEARCH_POSITION_TRIGGER
562
+ // Implemented by passing autofocus to the underlying input's autofocus
563
+ // 2. filterTreeNode && searchPosition === strings.SEARCH_POSITION_DROPDOWN
564
+ // Due to the off-screen rendering in the tooltip implementation mechanism, if it is implemented through the
565
+ // autofocus of the input, when the option panel is opened, the page will scroll to top, so it is necessary
566
+ // to call the focus method through ref in the onVisibleChange callback of the Popover to achieve focus
567
+
559
568
 
569
+ const autoFocus = filterTreeNode && searchPosition === strings.SEARCH_POSITION_TRIGGER ? searchAutoFocus : undefined;
560
570
  return /*#__PURE__*/React.createElement(TagInput, {
561
571
  maxTagCount: maxTagCount,
562
572
  disabled: disabled,
@@ -569,7 +579,7 @@ class TreeSelect extends BaseComponent {
569
579
  showRestTagsPopover: showRestTagsPopover,
570
580
  restTagsPopoverProps: restTagsPopoverProps,
571
581
  // eslint-disable-next-line jsx-a11y/no-autofocus
572
- autoFocus: searchAutoFocus,
582
+ autoFocus: autoFocus,
573
583
  renderTagItem: (itemKey, index) => this.renderTagItem(itemKey, index),
574
584
  onRemove: itemKey => this.removeTag(itemKey),
575
585
  expandRestTagsOnClick: false
@@ -605,6 +615,7 @@ class TreeSelect extends BaseComponent {
605
615
  prefix: /*#__PURE__*/React.createElement(IconSearch, null)
606
616
  };
607
617
  const inputTriggerProps = {
618
+ autofocus: searchAutoFocus,
608
619
  onFocus: e => this.foundation.handleInputTriggerFocus(),
609
620
  onBlur: e => this.foundation.handleInputTriggerBlur(),
610
621
  disabled
@@ -636,7 +647,6 @@ class TreeSelect extends BaseComponent {
636
647
  return /*#__PURE__*/React.createElement(Input, Object.assign({
637
648
  "aria-label": 'Filter TreeSelect item',
638
649
  ref: this.inputRef,
639
- autofocus: searchAutoFocus,
640
650
  placeholder: placeholder
641
651
  }, baseInputProps, realInputProps));
642
652
  }));
@@ -710,12 +720,18 @@ class TreeSelect extends BaseComponent {
710
720
 
711
721
  this.handlePopoverClose = isVisible => {
712
722
  const {
713
- filterTreeNode
723
+ filterTreeNode,
724
+ searchAutoFocus,
725
+ searchPosition
714
726
  } = this.props;
715
727
 
716
728
  if (isVisible === false && Boolean(filterTreeNode)) {
717
729
  this.foundation.clearInput();
718
730
  }
731
+
732
+ if (filterTreeNode && searchPosition === strings.SEARCH_POSITION_DROPDOWN && isVisible && searchAutoFocus) {
733
+ this.foundation.focusInput(true);
734
+ }
719
735
  };
720
736
 
721
737
  this.renderTreeNode = (treeNode, ind, style) => {
@@ -1179,7 +1195,25 @@ class TreeSelect extends BaseComponent {
1179
1195
  isHovering: bool
1180
1196
  });
1181
1197
  },
1182
- updateInputFocus: bool => {} // eslint-disable-line
1198
+ updateInputFocus: bool => {
1199
+ if (bool) {
1200
+ if (this.inputRef && this.inputRef.current) {
1201
+ this.inputRef.current.focus();
1202
+ }
1203
+
1204
+ if (this.tagInputRef && this.tagInputRef.current) {
1205
+ this.tagInputRef.current.focus();
1206
+ }
1207
+ } else {
1208
+ if (this.inputRef && this.inputRef.current) {
1209
+ this.inputRef.current.blur();
1210
+ }
1211
+
1212
+ if (this.tagInputRef && this.tagInputRef.current) {
1213
+ this.tagInputRef.current.blur();
1214
+ }
1215
+ }
1216
+ } // eslint-disable-line
1183
1217
 
1184
1218
  });
1185
1219
  }
@@ -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<NonNullable<PropTypes.ReactNodeLike>>;
@@ -38,7 +38,7 @@ export default class Numeral extends PureComponent<NumeralProps> {
38
38
  underline: PropTypes.Requireable<boolean>;
39
39
  link: PropTypes.Requireable<NonNullable<boolean | object>>;
40
40
  strong: PropTypes.Requireable<boolean>;
41
- type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
41
+ type: PropTypes.Requireable<"warning" | "success" | "primary" | "secondary" | "tertiary" | "danger" | "quaternary">;
42
42
  size: PropTypes.Requireable<"small" | "normal">;
43
43
  style: PropTypes.Requireable<object>;
44
44
  className: PropTypes.Requireable<string>;
@@ -29,7 +29,7 @@ export default class Paragraph extends PureComponent<ParagraphProps> {
29
29
  link: PropTypes.Requireable<NonNullable<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<NonNullable<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<NonNullable<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 | 6 | 5>;
39
+ type: PropTypes.Requireable<"warning" | "success" | "primary" | "secondary" | "tertiary" | "danger" | "quaternary">;
40
+ heading: PropTypes.Requireable<4 | 2 | 1 | 6 | 3 | 5>;
41
41
  style: PropTypes.Requireable<object>;
42
42
  className: PropTypes.Requireable<string>;
43
43
  component: PropTypes.Requireable<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.24.0-beta.1",
3
+ "version": "2.24.1-alpha.0",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -17,12 +17,12 @@
17
17
  "lib/*"
18
18
  ],
19
19
  "dependencies": {
20
- "@douyinfe/semi-animation": "2.24.0-beta.1",
21
- "@douyinfe/semi-animation-react": "2.24.0-beta.1",
22
- "@douyinfe/semi-foundation": "2.24.0-beta.1",
23
- "@douyinfe/semi-icons": "2.24.0-beta.1",
24
- "@douyinfe/semi-illustrations": "2.24.0-beta.1",
25
- "@douyinfe/semi-theme-default": "2.24.0-beta.1",
20
+ "@douyinfe/semi-animation": "2.24.1-alpha.0",
21
+ "@douyinfe/semi-animation-react": "2.24.1-alpha.0",
22
+ "@douyinfe/semi-foundation": "2.24.1-alpha.0",
23
+ "@douyinfe/semi-icons": "2.24.1-alpha.0",
24
+ "@douyinfe/semi-illustrations": "2.24.1-alpha.0",
25
+ "@douyinfe/semi-theme-default": "2.24.1-alpha.0",
26
26
  "async-validator": "^3.5.0",
27
27
  "classnames": "^2.2.6",
28
28
  "copy-text-to-clipboard": "^2.1.1",
@@ -69,7 +69,7 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "f15ac3497e2c0d9d7200c989d9393897c2c3b607",
72
+ "gitHead": "199105285d4ce2c2572968aeaf31e0a16c4b47f5",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",