@douyinfe/semi-ui 2.56.0-alpha.0 → 2.56.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 (85) hide show
  1. package/dist/css/semi.css +41 -9
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +76 -47
  4. package/dist/umd/semi-ui.js.map +1 -1
  5. package/dist/umd/semi-ui.min.js +1 -1
  6. package/dist/umd/semi-ui.min.js.map +1 -1
  7. package/lib/cjs/_base/base.css +5 -7
  8. package/lib/cjs/anchor/index.d.ts +1 -1
  9. package/lib/cjs/autoComplete/index.d.ts +1 -1
  10. package/lib/cjs/autoComplete/index.js +2 -1
  11. package/lib/cjs/backtop/index.d.ts +1 -0
  12. package/lib/cjs/backtop/index.js +4 -1
  13. package/lib/cjs/button/Button.d.ts +1 -1
  14. package/lib/cjs/button/buttonGroup.d.ts +1 -1
  15. package/lib/cjs/button/index.d.ts +1 -1
  16. package/lib/cjs/calendar/monthCalendar.js +3 -1
  17. package/lib/cjs/cascader/index.js +8 -4
  18. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  19. package/lib/cjs/datePicker/datePicker.js +5 -9
  20. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  21. package/lib/cjs/form/baseForm.d.ts +2 -2
  22. package/lib/cjs/form/field.d.ts +2 -2
  23. package/lib/cjs/input/index.d.ts +1 -1
  24. package/lib/cjs/input/inputGroup.d.ts +1 -1
  25. package/lib/cjs/locale/source/ro.d.ts +3 -170
  26. package/lib/cjs/locale/source/ro.js +5 -5
  27. package/lib/cjs/modal/confirm.d.ts +16 -16
  28. package/lib/cjs/radio/radio.d.ts +1 -1
  29. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  30. package/lib/cjs/rating/index.d.ts +1 -1
  31. package/lib/cjs/rating/item.d.ts +1 -1
  32. package/lib/cjs/select/index.js +3 -3
  33. package/lib/cjs/switch/index.d.ts +1 -1
  34. package/lib/cjs/table/Table.d.ts +2 -2
  35. package/lib/cjs/table/index.d.ts +1 -1
  36. package/lib/cjs/tagInput/index.d.ts +1 -1
  37. package/lib/cjs/tagInput/index.js +2 -1
  38. package/lib/cjs/timePicker/TimePicker.d.ts +2 -1
  39. package/lib/cjs/timePicker/TimePicker.js +8 -8
  40. package/lib/cjs/timePicker/index.d.ts +1 -1
  41. package/lib/cjs/tooltip/index.js +4 -1
  42. package/lib/cjs/treeSelect/index.js +4 -3
  43. package/lib/cjs/typography/base.d.ts +8 -0
  44. package/lib/cjs/typography/base.js +28 -4
  45. package/lib/cjs/typography/title.d.ts +2 -2
  46. package/lib/es/_base/base.css +5 -7
  47. package/lib/es/anchor/index.d.ts +1 -1
  48. package/lib/es/autoComplete/index.d.ts +1 -1
  49. package/lib/es/autoComplete/index.js +2 -1
  50. package/lib/es/backtop/index.d.ts +1 -0
  51. package/lib/es/backtop/index.js +4 -1
  52. package/lib/es/button/Button.d.ts +1 -1
  53. package/lib/es/button/buttonGroup.d.ts +1 -1
  54. package/lib/es/button/index.d.ts +1 -1
  55. package/lib/es/calendar/monthCalendar.js +3 -1
  56. package/lib/es/cascader/index.js +8 -4
  57. package/lib/es/datePicker/datePicker.d.ts +1 -1
  58. package/lib/es/datePicker/datePicker.js +5 -9
  59. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  60. package/lib/es/form/baseForm.d.ts +2 -2
  61. package/lib/es/form/field.d.ts +2 -2
  62. package/lib/es/input/index.d.ts +1 -1
  63. package/lib/es/input/inputGroup.d.ts +1 -1
  64. package/lib/es/locale/source/ro.d.ts +3 -170
  65. package/lib/es/locale/source/ro.js +6 -6
  66. package/lib/es/modal/confirm.d.ts +16 -16
  67. package/lib/es/radio/radio.d.ts +1 -1
  68. package/lib/es/radio/radioGroup.d.ts +1 -1
  69. package/lib/es/rating/index.d.ts +1 -1
  70. package/lib/es/rating/item.d.ts +1 -1
  71. package/lib/es/select/index.js +3 -3
  72. package/lib/es/switch/index.d.ts +1 -1
  73. package/lib/es/table/Table.d.ts +2 -2
  74. package/lib/es/table/index.d.ts +1 -1
  75. package/lib/es/tagInput/index.d.ts +1 -1
  76. package/lib/es/tagInput/index.js +2 -1
  77. package/lib/es/timePicker/TimePicker.d.ts +2 -1
  78. package/lib/es/timePicker/TimePicker.js +8 -8
  79. package/lib/es/timePicker/index.d.ts +1 -1
  80. package/lib/es/tooltip/index.js +4 -1
  81. package/lib/es/treeSelect/index.js +4 -3
  82. package/lib/es/typography/base.d.ts +8 -0
  83. package/lib/es/typography/base.js +28 -4
  84. package/lib/es/typography/title.d.ts +2 -2
  85. package/package.json +8 -8
@@ -1,170 +1,3 @@
1
- /**
2
- * [i18n-Romanian]
3
- */
4
- declare const _default: {
5
- code: string;
6
- dateFnsLocale: Locale;
7
- Pagination: {
8
- pageSize: string;
9
- total: string;
10
- jumpTo: string;
11
- page: string;
12
- };
13
- Modal: {
14
- confirm: string;
15
- cancel: string;
16
- };
17
- TimePicker: {
18
- placeholder: {
19
- time: string;
20
- timeRange: string;
21
- };
22
- begin: string;
23
- end: string;
24
- hour: string;
25
- minute: string;
26
- second: string;
27
- AM: string;
28
- PM: string;
29
- };
30
- DatePicker: {
31
- placeholder: {
32
- date: string;
33
- dateTime: string;
34
- dateRange: string[];
35
- dateTimeRange: string[];
36
- monthRange: string[];
37
- };
38
- presets: string;
39
- footer: {
40
- confirm: string;
41
- cancel: string;
42
- };
43
- selectDate: string;
44
- selectTime: string;
45
- year: string;
46
- month: string;
47
- day: string;
48
- monthText: string;
49
- months: {
50
- 1: string;
51
- 2: string;
52
- 3: string;
53
- 4: string;
54
- 5: string;
55
- 6: string;
56
- 7: string;
57
- 8: string;
58
- 9: string;
59
- 10: string;
60
- 11: string;
61
- 12: string;
62
- };
63
- fullMonths: {
64
- 1: string;
65
- 2: string;
66
- 3: string;
67
- 4: string;
68
- 5: string;
69
- 6: string;
70
- 7: string;
71
- 8: string;
72
- 9: string;
73
- 10: string;
74
- 11: string;
75
- 12: string;
76
- };
77
- weeks: {
78
- Mon: string;
79
- Tue: string;
80
- Wed: string;
81
- Thu: string;
82
- Fri: string;
83
- Sat: string;
84
- Sun: string;
85
- };
86
- localeFormatToken: {
87
- FORMAT_SWITCH_DATE: string;
88
- };
89
- };
90
- Popconfirm: {
91
- confirm: string;
92
- cancel: string;
93
- };
94
- Navigation: {
95
- collapseText: string;
96
- expandText: string;
97
- };
98
- Table: {
99
- emptyText: string;
100
- pageText: string;
101
- };
102
- Select: {
103
- emptyText: string;
104
- createText: string;
105
- };
106
- Tree: {
107
- emptyText: string;
108
- };
109
- Cascader: {
110
- emptyText: string;
111
- };
112
- List: {
113
- emptyText: string;
114
- };
115
- Calendar: {
116
- allDay: string;
117
- AM: string;
118
- PM: string;
119
- datestring: string;
120
- remaining: string;
121
- };
122
- Upload: {
123
- mainText: string;
124
- illegalTips: string;
125
- legalTips: string;
126
- retry: string;
127
- replace: string;
128
- clear: string;
129
- selectedFiles: string;
130
- illegalSize: string;
131
- fail: string;
132
- };
133
- TreeSelect: {
134
- searchPlaceholder: string;
135
- };
136
- Typography: {
137
- copy: string;
138
- copied: string;
139
- expand: string;
140
- collapse: string;
141
- };
142
- Transfer: {
143
- emptyLeft: string;
144
- emptySearch: string;
145
- emptyRight: string;
146
- placeholder: string;
147
- clear: string;
148
- selectAll: string;
149
- clearSelectAll: string;
150
- total: string;
151
- selected: string;
152
- };
153
- Form: {
154
- optional: string;
155
- };
156
- Image: {
157
- preview: string;
158
- loading: string;
159
- loadError: string;
160
- prevTip: string;
161
- nextTip: string;
162
- zoomInTip: string;
163
- zoomOutTip: string;
164
- rotateTip: string;
165
- downloadTip: string;
166
- adaptiveTip: string;
167
- originTip: string;
168
- };
169
- };
170
- export default _default;
1
+ import { Locale } from '../interface';
2
+ declare const local: Locale;
3
+ export default local;
@@ -1,8 +1,5 @@
1
1
  import { ro } from 'date-fns/locale';
2
- /**
3
- * [i18n-Romanian]
4
- */
5
- export default {
2
+ const local = {
6
3
  code: 'ro',
7
4
  dateFnsLocale: ro,
8
5
  Pagination: {
@@ -105,7 +102,8 @@ export default {
105
102
  createText: 'Creează'
106
103
  },
107
104
  Tree: {
108
- emptyText: 'Nici un rezultat'
105
+ emptyText: 'Nici un rezultat',
106
+ searchPlaceholder: 'Căutare'
109
107
  },
110
108
  Cascader: {
111
109
  emptyText: 'Nici un rezultat'
@@ -167,4 +165,6 @@ export default {
167
165
  adaptiveTip: 'Afișaj adaptabil',
168
166
  originTip: 'Afișaj implicit'
169
167
  }
170
- };
168
+ };
169
+ // [i18n-Romanian] 罗马尼亚语
170
+ export default local;
@@ -143,19 +143,19 @@ export declare function withWarning(props: ModalReactProps): {
143
143
  type: "warning";
144
144
  };
145
145
  export declare function withError(props: ModalReactProps): {
146
+ title?: React.ReactNode;
146
147
  children?: React.ReactNode;
148
+ size?: import("@douyinfe/semi-foundation/lib/es/modal/modalFoundation").Size;
149
+ style?: React.CSSProperties;
150
+ className?: string;
151
+ motion?: boolean;
152
+ getPopupContainer?: () => HTMLElement;
147
153
  footer?: React.ReactNode;
148
154
  header?: React.ReactNode;
149
- style?: React.CSSProperties;
150
- title?: React.ReactNode;
155
+ direction?: any;
151
156
  mask?: boolean;
152
157
  visible?: boolean;
153
- className?: string;
154
158
  zIndex?: number;
155
- getPopupContainer?: () => HTMLElement;
156
- direction?: any;
157
- size?: import("@douyinfe/semi-foundation/lib/es/modal/modalFoundation").Size;
158
- motion?: boolean;
159
159
  width?: string | number;
160
160
  height?: string | number;
161
161
  content?: React.ReactNode;
@@ -205,6 +205,13 @@ export declare function withError(props: ModalReactProps): {
205
205
  onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;
206
206
  onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;
207
207
  'aria-label'?: string;
208
+ title?: string;
209
+ name?: string;
210
+ value?: string | number | readonly string[];
211
+ onAnimationStart?: React.AnimationEventHandler<HTMLButtonElement>;
212
+ onAnimationEnd?: React.AnimationEventHandler<HTMLButtonElement>;
213
+ form?: string;
214
+ slot?: string;
208
215
  prefix?: string;
209
216
  dangerouslySetInnerHTML?: {
210
217
  __html: string | TrustedHTML;
@@ -359,17 +366,12 @@ export declare function withError(props: ModalReactProps): {
359
366
  onScrollCapture?: React.UIEventHandler<HTMLButtonElement>;
360
367
  onWheel?: React.WheelEventHandler<HTMLButtonElement>;
361
368
  onWheelCapture?: React.WheelEventHandler<HTMLButtonElement>;
362
- onAnimationStart?: React.AnimationEventHandler<HTMLButtonElement>;
363
369
  onAnimationStartCapture?: React.AnimationEventHandler<HTMLButtonElement>;
364
- onAnimationEnd?: React.AnimationEventHandler<HTMLButtonElement>;
365
370
  onAnimationEndCapture?: React.AnimationEventHandler<HTMLButtonElement>;
366
371
  onAnimationIteration?: React.AnimationEventHandler<HTMLButtonElement>;
367
372
  onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement>;
368
373
  onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement>;
369
374
  onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement>;
370
- form?: string;
371
- slot?: string;
372
- title?: string;
373
375
  hidden?: boolean;
374
376
  color?: string;
375
377
  defaultChecked?: boolean;
@@ -378,8 +380,6 @@ export declare function withError(props: ModalReactProps): {
378
380
  suppressHydrationWarning?: boolean;
379
381
  accessKey?: string;
380
382
  autoFocus?: boolean;
381
- value?: string | number | readonly string[];
382
- name?: string;
383
383
  contextMenu?: string;
384
384
  dir?: string;
385
385
  draggable?: boolean | "true" | "false";
@@ -387,7 +387,7 @@ export declare function withError(props: ModalReactProps): {
387
387
  translate?: "no" | "yes";
388
388
  role?: React.AriaRole;
389
389
  contentEditable?: "inherit" | (boolean | "true" | "false");
390
- inputMode?: "search" | "text" | "none" | "email" | "tel" | "url" | "numeric" | "decimal";
390
+ inputMode?: "search" | "none" | "text" | "email" | "tel" | "url" | "numeric" | "decimal";
391
391
  nonce?: string;
392
392
  tabIndex?: number;
393
393
  content?: string;
@@ -421,7 +421,7 @@ export declare function withError(props: ModalReactProps): {
421
421
  is?: string;
422
422
  'aria-activedescendant'?: string;
423
423
  'aria-atomic'?: boolean | "true" | "false";
424
- 'aria-autocomplete'?: "none" | "list" | "both" | "inline";
424
+ 'aria-autocomplete'?: "both" | "none" | "list" | "inline";
425
425
  'aria-busy'?: boolean | "true" | "false";
426
426
  'aria-checked'?: boolean | "true" | "false" | "mixed";
427
427
  'aria-colcount'?: number;
@@ -61,7 +61,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
61
61
  extra: PropTypes.Requireable<PropTypes.ReactNodeLike>;
62
62
  addonStyle: PropTypes.Requireable<object>;
63
63
  addonClassName: PropTypes.Requireable<string>;
64
- type: PropTypes.Requireable<"button" | "default" | "card" | "pureCard">;
64
+ type: PropTypes.Requireable<"default" | "button" | "card" | "pureCard">;
65
65
  'aria-label': PropTypes.Requireable<string>;
66
66
  preventScroll: PropTypes.Requireable<boolean>;
67
67
  };
@@ -49,7 +49,7 @@ declare class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState>
49
49
  name: PropTypes.Requireable<string>;
50
50
  options: PropTypes.Requireable<any[]>;
51
51
  buttonSize: PropTypes.Requireable<"small" | "middle" | "large">;
52
- type: PropTypes.Requireable<"button" | "default" | "card" | "pureCard">;
52
+ type: PropTypes.Requireable<"default" | "button" | "card" | "pureCard">;
53
53
  value: PropTypes.Requireable<any>;
54
54
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
55
55
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -69,7 +69,7 @@ export default class Rating extends BaseComponent<RatingProps, RatingState> {
69
69
  onBlur: PropTypes.Requireable<(...args: any[]) => any>;
70
70
  onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
71
71
  autoFocus: PropTypes.Requireable<boolean>;
72
- size: PropTypes.Requireable<NonNullable<number | "small" | "default">>;
72
+ size: PropTypes.Requireable<NonNullable<number | "default" | "small">>;
73
73
  tooltips: PropTypes.Requireable<string[]>;
74
74
  id: PropTypes.Requireable<string>;
75
75
  preventScroll: PropTypes.Requireable<boolean>;
@@ -40,7 +40,7 @@ export default class Item extends BaseComponent<RatingItemProps, RatingItemState
40
40
  disabled: PropTypes.Requireable<boolean>;
41
41
  count: PropTypes.Requireable<number>;
42
42
  ariaLabelPrefix: PropTypes.Requireable<string>;
43
- size: PropTypes.Requireable<NonNullable<number | "small" | "default">>;
43
+ size: PropTypes.Requireable<NonNullable<number | "default" | "small">>;
44
44
  'aria-describedby': PropTypes.Requireable<string>;
45
45
  onFocus: PropTypes.Requireable<(...args: any[]) => any>;
46
46
  onBlur: PropTypes.Requireable<(...args: any[]) => any>;
@@ -187,9 +187,9 @@ class Select extends BaseComponent {
187
187
  const optionInstance = this.optionsRef && this.optionsRef.current;
188
188
  const triggerDom = this.triggerRef && this.triggerRef.current;
189
189
  const optionsDom = ReactDOM.findDOMNode(optionInstance);
190
- // let isInPanel = optionsDom && optionsDom.contains(e.target);
191
- // let isInTrigger = triggerDom && triggerDom.contains(e.target);
192
- if (optionsDom && !optionsDom.contains(e.target) && triggerDom && !triggerDom.contains(e.target)) {
190
+ const target = e.target;
191
+ const path = e.composedPath && e.composedPath() || [target];
192
+ if (!(optionsDom && optionsDom.contains(target)) && !(triggerDom && triggerDom.contains(target)) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
193
193
  cb(e);
194
194
  }
195
195
  };
@@ -45,7 +45,7 @@ declare class Switch extends BaseComponent<SwitchProps, SwitchState> {
45
45
  onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
46
46
  onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
47
47
  style: PropTypes.Requireable<object>;
48
- size: PropTypes.Requireable<"small" | "default" | "large">;
48
+ size: PropTypes.Requireable<"default" | "small" | "large">;
49
49
  uncheckedText: PropTypes.Requireable<PropTypes.ReactNodeLike>;
50
50
  id: PropTypes.Requireable<string>;
51
51
  };
@@ -60,7 +60,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
60
60
  components: PropTypes.Requireable<any>;
61
61
  bordered: PropTypes.Requireable<boolean>;
62
62
  loading: PropTypes.Requireable<boolean>;
63
- size: PropTypes.Requireable<"small" | "middle" | "default">;
63
+ size: PropTypes.Requireable<"default" | "small" | "middle">;
64
64
  tableLayout: PropTypes.Requireable<"" | "fixed" | "auto">;
65
65
  columns: PropTypes.Requireable<PropTypes.InferProps<{
66
66
  align: PropTypes.Requireable<"center" | "left" | "right">;
@@ -297,7 +297,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
297
297
  showTotal?: boolean;
298
298
  pageSize?: number;
299
299
  pageSizeOpts?: number[];
300
- size?: "small" | "default";
300
+ size?: "default" | "small";
301
301
  currentPage?: number;
302
302
  defaultCurrentPage?: number;
303
303
  onPageChange?: (currentPage: number) => void;
@@ -16,7 +16,7 @@ declare class Table<RecordType extends Record<string, any> = Data> extends React
16
16
  components: PropTypes.Requireable<any>;
17
17
  bordered: PropTypes.Requireable<boolean>;
18
18
  loading: PropTypes.Requireable<boolean>;
19
- size: PropTypes.Requireable<"small" | "middle" | "default">;
19
+ size: PropTypes.Requireable<"default" | "small" | "middle">;
20
20
  tableLayout: PropTypes.Requireable<"" | "fixed" | "auto">;
21
21
  columns: PropTypes.Requireable<PropTypes.InferProps<{
22
22
  align: PropTypes.Requireable<"center" | "left" | "right">;
@@ -97,7 +97,7 @@ declare class TagInput extends BaseComponent<TagInputProps, TagInputState> {
97
97
  onAdd: PropTypes.Requireable<(...args: any[]) => any>;
98
98
  onRemove: PropTypes.Requireable<(...args: any[]) => any>;
99
99
  onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
100
- size: PropTypes.Requireable<"small" | "default" | "large">;
100
+ size: PropTypes.Requireable<"default" | "small" | "large">;
101
101
  validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
102
102
  prefix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
103
103
  suffix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
@@ -263,7 +263,8 @@ class TagInput extends BaseComponent {
263
263
  const clickOutsideHandler = e => {
264
264
  const tagInputDom = this.tagInputRef && this.tagInputRef.current;
265
265
  const target = e.target;
266
- if (tagInputDom && !tagInputDom.contains(target)) {
266
+ const path = e.composedPath && e.composedPath() || [target];
267
+ if (tagInputDom && !tagInputDom.contains(target) && !path.includes(tagInputDom)) {
267
268
  cb(e);
268
269
  }
269
270
  };
@@ -133,7 +133,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
133
133
  secondStep: PropTypes.Requireable<number>;
134
134
  focusOnOpen: PropTypes.Requireable<boolean>;
135
135
  autoFocus: PropTypes.Requireable<boolean>;
136
- size: PropTypes.Requireable<"small" | "default" | "large">;
136
+ size: PropTypes.Requireable<"default" | "small" | "large">;
137
137
  stopPropagation: PropTypes.Requireable<boolean>;
138
138
  panels: PropTypes.Requireable<PropTypes.InferProps<{
139
139
  panelHeader: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
@@ -193,6 +193,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
193
193
  foundation: TimePickerFoundation;
194
194
  timePickerRef: React.MutableRefObject<HTMLDivElement>;
195
195
  savePanelRef: React.RefObject<HTMLDivElement>;
196
+ useCustomTrigger: boolean;
196
197
  clickOutSideHandler: (e: MouseEvent) => void;
197
198
  constructor(props: TimePickerProps);
198
199
  get adapter(): TimePickerAdapter<TimePickerProps, TimePickerState>;
@@ -85,6 +85,7 @@ export default class TimePicker extends BaseComponent {
85
85
  this.foundation = new TimePickerFoundation(this.adapter);
86
86
  this.timePickerRef = /*#__PURE__*/React.createRef();
87
87
  this.savePanelRef = /*#__PURE__*/React.createRef();
88
+ this.useCustomTrigger = typeof this.props.triggerRender === 'function';
88
89
  }
89
90
  get adapter() {
90
91
  var _this2 = this;
@@ -100,11 +101,11 @@ export default class TimePicker extends BaseComponent {
100
101
  }
101
102
  this.clickOutSideHandler = e => {
102
103
  const panel = this.savePanelRef && this.savePanelRef.current;
103
- const isInPanel = e.target && panel && panel.contains(e.target);
104
- const isInTimepicker = this.timePickerRef && this.timePickerRef.current && this.timePickerRef.current.contains(e.target);
105
- if (!isInTimepicker && !isInPanel) {
106
- const clickedOutside = true;
107
- this.foundation.handlePanelClose(clickedOutside, e);
104
+ const trigger = this.timePickerRef && this.timePickerRef.current;
105
+ const target = e.target;
106
+ const path = e.composedPath && e.composedPath() || [target];
107
+ if (!(panel && panel.contains(target)) && !(trigger && trigger.contains(target)) && !(path.includes(trigger) || path.includes(panel))) {
108
+ this.foundation.handlePanelClose(true, e);
108
109
  }
109
110
  };
110
111
  document.addEventListener('mousedown', this.clickOutSideHandler);
@@ -268,7 +269,6 @@ export default class TimePicker extends BaseComponent {
268
269
  rest = __rest(_a, ["prefixCls", "placeholder", "disabled", "defaultValue", "dropdownMargin", "className", "popupStyle", "size", "style", "locale", "localeCode", "zIndex", "getPopupContainer", "insetLabel", "insetLabelId", "inputStyle", "showClear", "panelHeader", "panelFooter", "rangeSeparator", "onOpenChange", "onChangeWithDateFirst", "popupClassName", "hideDisabledOptions", "use12Hours", "minuteStep", "hourStep", "secondStep", "scrollItemProps", "triggerRender", "motion", "autoAdjustOverflow", "stopPropagation"]);
269
270
  const format = this.foundation.getDefaultFormatIfNeed();
270
271
  const position = this.foundation.getPosition();
271
- const useCustomTrigger = typeof triggerRender === 'function';
272
272
  const {
273
273
  open,
274
274
  inputValue,
@@ -302,7 +302,7 @@ export default class TimePicker extends BaseComponent {
302
302
  onBlur: this.handleBlur
303
303
  });
304
304
  const outerProps = {};
305
- if (useCustomTrigger) {
305
+ if (this.useCustomTrigger) {
306
306
  outerProps.onClick = this.openPanel;
307
307
  }
308
308
  return /*#__PURE__*/React.createElement("div", Object.assign({
@@ -325,7 +325,7 @@ export default class TimePicker extends BaseComponent {
325
325
  margin: dropdownMargin,
326
326
  autoAdjustOverflow: autoAdjustOverflow,
327
327
  stopPropagation: stopPropagation
328
- }, useCustomTrigger ? /*#__PURE__*/React.createElement(Trigger, {
328
+ }, this.useCustomTrigger ? /*#__PURE__*/React.createElement(Trigger, {
329
329
  triggerRender: triggerRender,
330
330
  disabled: disabled,
331
331
  value: value,
@@ -49,7 +49,7 @@ export default class LocaleTimePicker extends React.PureComponent<LocalePickerPr
49
49
  secondStep: import("prop-types").Requireable<number>;
50
50
  focusOnOpen: import("prop-types").Requireable<boolean>;
51
51
  autoFocus: import("prop-types").Requireable<boolean>;
52
- size: import("prop-types").Requireable<"small" | "default" | "large">;
52
+ size: import("prop-types").Requireable<"default" | "small" | "large">;
53
53
  stopPropagation: import("prop-types").Requireable<boolean>;
54
54
  panels: import("prop-types").Requireable<import("prop-types").InferProps<{
55
55
  panelHeader: import("prop-types").Requireable<NonNullable<import("prop-types").ReactNodeLike>>;
@@ -423,7 +423,10 @@ export default class Tooltip extends BaseComponent {
423
423
  let popupEl = this.containerEl && this.containerEl.current;
424
424
  el = ReactDOM.findDOMNode(el);
425
425
  popupEl = ReactDOM.findDOMNode(popupEl);
426
- if (el && !el.contains(e.target) && popupEl && !popupEl.contains(e.target) || this.props.clickTriggerToHide && el && el.contains(e.target)) {
426
+ const target = e.target;
427
+ const path = e.composedPath && e.composedPath() || [target];
428
+ const isClickTriggerToHide = this.props.clickTriggerToHide ? el && el.contains(target) || path.includes(el) : false;
429
+ if (el && !el.contains(target) && popupEl && !popupEl.contains(target) && !(path.includes(popupEl) || path.includes(el)) || isClickTriggerToHide) {
427
430
  this.props.onClickOutSide(e);
428
431
  cb();
429
432
  }
@@ -1105,7 +1105,8 @@ class TreeSelect extends BaseComponent {
1105
1105
  const triggerDom = this.triggerRef && this.triggerRef.current;
1106
1106
  const optionsDom = ReactDOM.findDOMNode(optionInstance);
1107
1107
  const target = e.target;
1108
- if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target)) {
1108
+ const path = e.composedPath && e.composedPath() || [target];
1109
+ if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
1109
1110
  cb(e);
1110
1111
  }
1111
1112
  };
@@ -1133,8 +1134,8 @@ class TreeSelect extends BaseComponent {
1133
1134
  notifySelect: (selectKey, bool, node) => {
1134
1135
  this.props.onSelect && this.props.onSelect(selectKey, bool, node);
1135
1136
  },
1136
- notifySearch: (input, filteredExpandedKeys, filteredNodes) => {
1137
- this.props.onSearch && this.props.onSearch(input, filteredExpandedKeys, filteredNodes);
1137
+ notifySearch: (input, filteredExpandedKeys) => {
1138
+ this.props.onSearch && this.props.onSearch(input, filteredExpandedKeys);
1138
1139
  },
1139
1140
  cacheFlattenNodes: bool => {
1140
1141
  this.setState({
@@ -132,6 +132,14 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
132
132
  * @returns {Boolean}
133
133
  */
134
134
  shouldTruncated: (rows: number) => boolean;
135
+ /**
136
+ * 通过将 content 给到 Range 对象,借助 Range 的 getBoundingClientRect 拿到 content 的准确 width
137
+ * 不受 css ellipsis 与否的影响
138
+ * By giving the content to the Range object, get the exact width of the content with the help of Range's getBoundingClientRect
139
+ * Not affected by css ellipsis or not
140
+ * https://github.com/DouyinFE/semi-design/issues/1731
141
+ */
142
+ compareSingleRow: () => boolean;
135
143
  showTooltip: () => boolean | ShowTooltip | {
136
144
  type: string;
137
145
  };
@@ -123,9 +123,32 @@ export default class Base extends Component {
123
123
  if (!rows || rows < 1) {
124
124
  return false;
125
125
  }
126
- const updateOverflow = rows <= 1 ? this.wrapperRef.current.scrollWidth > this.wrapperRef.current.offsetWidth : this.wrapperRef.current.scrollHeight > this.wrapperRef.current.offsetHeight;
126
+ const updateOverflow = rows <= 1 ? this.compareSingleRow() : this.wrapperRef.current.scrollHeight > this.wrapperRef.current.offsetHeight;
127
127
  return updateOverflow;
128
128
  };
129
+ /**
130
+ * 通过将 content 给到 Range 对象,借助 Range 的 getBoundingClientRect 拿到 content 的准确 width
131
+ * 不受 css ellipsis 与否的影响
132
+ * By giving the content to the Range object, get the exact width of the content with the help of Range's getBoundingClientRect
133
+ * Not affected by css ellipsis or not
134
+ * https://github.com/DouyinFE/semi-design/issues/1731
135
+ */
136
+ this.compareSingleRow = () => {
137
+ if (!(document && document.createRange)) {
138
+ return false;
139
+ }
140
+ const containerNode = this.wrapperRef.current;
141
+ const containerWidth = containerNode.getBoundingClientRect().width;
142
+ const childNodes = Array.from(containerNode.childNodes);
143
+ const range = document.createRange();
144
+ const contentWidth = childNodes.reduce((acc, node) => {
145
+ var _a;
146
+ range.selectNodeContents(node);
147
+ return acc + ((_a = range.getBoundingClientRect().width) !== null && _a !== void 0 ? _a : 0);
148
+ }, 0);
149
+ range.detach();
150
+ return contentWidth > containerWidth;
151
+ };
129
152
  this.showTooltip = () => {
130
153
  var _a, _b;
131
154
  const {
@@ -232,14 +255,15 @@ export default class Base extends Component {
232
255
  expand: this.expandRef.current,
233
256
  copy: this.copyRef && this.copyRef.current
234
257
  };
235
- const content = getRenderText(this.wrapperRef.current, rows,
236
258
  // Perform type conversion on children to prevent component crash due to non-string type of children
237
- String(children), extraNode, ELLIPSIS_STR, suffix, pos);
259
+ // https://github.com/DouyinFE/semi-design/issues/2167
260
+ const realChildren = Array.isArray(children) ? children.join('') : String(children);
261
+ const content = getRenderText(this.wrapperRef.current, rows, realChildren, extraNode, ELLIPSIS_STR, suffix, pos);
238
262
  return new Promise(resolve => {
239
263
  this.setState({
240
264
  isOverflowed: false,
241
265
  ellipsisContent: content,
242
- isTruncated: children !== content
266
+ isTruncated: realChildren !== content
243
267
  }, resolve);
244
268
  });
245
269
  });
@@ -60,11 +60,11 @@ export default class Title extends PureComponent<TitleProps> {
60
60
  underline: PropTypes.Requireable<boolean>;
61
61
  strong: PropTypes.Requireable<boolean>;
62
62
  type: PropTypes.Requireable<"warning" | "success" | "primary" | "secondary" | "danger" | "tertiary" | "quaternary">;
63
- heading: PropTypes.Requireable<2 | 1 | 4 | 3 | 5 | 6>;
63
+ heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 5 | 6>;
64
64
  style: PropTypes.Requireable<object>;
65
65
  className: PropTypes.Requireable<string>;
66
66
  component: PropTypes.Requireable<string>;
67
- weight: PropTypes.Requireable<NonNullable<number | "bold" | "default" | "medium" | "light" | "regular" | "semibold">>;
67
+ weight: PropTypes.Requireable<NonNullable<number | "default" | "bold" | "medium" | "light" | "regular" | "semibold">>;
68
68
  };
69
69
  static defaultProps: {
70
70
  copyable: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.56.0-alpha.0",
3
+ "version": "2.56.0",
4
4
  "description": "A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -20,12 +20,12 @@
20
20
  "@dnd-kit/core": "^6.0.8",
21
21
  "@dnd-kit/sortable": "^7.0.2",
22
22
  "@dnd-kit/utilities": "^3.2.1",
23
- "@douyinfe/semi-animation": "2.56.0-alpha.0",
24
- "@douyinfe/semi-animation-react": "2.56.0-alpha.0",
25
- "@douyinfe/semi-foundation": "2.56.0-alpha.0",
26
- "@douyinfe/semi-icons": "2.56.0-alpha.0",
27
- "@douyinfe/semi-illustrations": "2.56.0-alpha.0",
28
- "@douyinfe/semi-theme-default": "2.56.0-alpha.0",
23
+ "@douyinfe/semi-animation": "2.56.0",
24
+ "@douyinfe/semi-animation-react": "2.56.0",
25
+ "@douyinfe/semi-foundation": "2.56.0",
26
+ "@douyinfe/semi-icons": "2.56.0",
27
+ "@douyinfe/semi-illustrations": "2.56.0",
28
+ "@douyinfe/semi-theme-default": "2.56.0",
29
29
  "async-validator": "^3.5.0",
30
30
  "classnames": "^2.2.6",
31
31
  "copy-text-to-clipboard": "^2.1.1",
@@ -75,7 +75,7 @@
75
75
  ],
76
76
  "author": "",
77
77
  "license": "MIT",
78
- "gitHead": "c66a7f2315110d6af211d6edb6163c71a4d8aaa8",
78
+ "gitHead": "df0bd1db35dc3e9fc6b78202ea2eb5d5d60e2256",
79
79
  "devDependencies": {
80
80
  "@babel/plugin-proposal-decorators": "^7.15.8",
81
81
  "@babel/plugin-transform-runtime": "^7.15.8",