@douyinfe/semi-ui 2.56.0-beta.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.
- package/dist/css/semi.css +13 -10
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +36 -12
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/cascader/index.js +6 -3
- package/lib/cjs/locale/source/ro.d.ts +3 -170
- package/lib/cjs/locale/source/ro.js +5 -5
- package/lib/cjs/typography/base.d.ts +8 -0
- package/lib/cjs/typography/base.js +28 -4
- package/lib/es/cascader/index.js +6 -3
- package/lib/es/locale/source/ro.d.ts +3 -170
- package/lib/es/locale/source/ro.js +6 -6
- package/lib/es/typography/base.d.ts +8 -0
- package/lib/es/typography/base.js +28 -4
- package/package.json +8 -8
|
@@ -741,9 +741,9 @@ class Cascader extends _baseComponent.default {
|
|
|
741
741
|
}, []);
|
|
742
742
|
return formatKeys;
|
|
743
743
|
};
|
|
744
|
-
const needUpdateTreeData = needUpdate('treeData') || needUpdateData();
|
|
745
|
-
const needUpdateValue = needUpdate('value') || (0, _isEmpty2.default)(prevProps) && defaultValue;
|
|
746
744
|
if (multiple) {
|
|
745
|
+
const needUpdateTreeData = needUpdate('treeData') || needUpdateData();
|
|
746
|
+
const needUpdateValue = needUpdate('value') || (0, _isEmpty2.default)(prevProps) && defaultValue;
|
|
747
747
|
// when value and treedata need updated
|
|
748
748
|
if (needUpdateTreeData || needUpdateValue) {
|
|
749
749
|
// update state.keyEntities
|
|
@@ -791,8 +791,11 @@ class Cascader extends _baseComponent.default {
|
|
|
791
791
|
this.foundation.destroy();
|
|
792
792
|
}
|
|
793
793
|
componentDidUpdate(prevProps) {
|
|
794
|
+
if (this.props.multiple) {
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
794
797
|
let isOptionsChanged = false;
|
|
795
|
-
if (!(0, _isEqual2.default)(prevProps.treeData, this.props.treeData)
|
|
798
|
+
if (!(0, _isEqual2.default)(prevProps.treeData, this.props.treeData)) {
|
|
796
799
|
isOptionsChanged = true;
|
|
797
800
|
this.foundation.collectOptions();
|
|
798
801
|
}
|
|
@@ -1,170 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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;
|
|
@@ -5,10 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _locale = require("date-fns/locale");
|
|
8
|
-
|
|
9
|
-
* [i18n-Romanian]
|
|
10
|
-
*/
|
|
11
|
-
var _default = {
|
|
8
|
+
const local = {
|
|
12
9
|
code: 'ro',
|
|
13
10
|
dateFnsLocale: _locale.ro,
|
|
14
11
|
Pagination: {
|
|
@@ -111,7 +108,8 @@ var _default = {
|
|
|
111
108
|
createText: 'Creează'
|
|
112
109
|
},
|
|
113
110
|
Tree: {
|
|
114
|
-
emptyText: 'Nici un rezultat'
|
|
111
|
+
emptyText: 'Nici un rezultat',
|
|
112
|
+
searchPlaceholder: 'Căutare'
|
|
115
113
|
},
|
|
116
114
|
Cascader: {
|
|
117
115
|
emptyText: 'Nici un rezultat'
|
|
@@ -174,4 +172,6 @@ var _default = {
|
|
|
174
172
|
originTip: 'Afișaj implicit'
|
|
175
173
|
}
|
|
176
174
|
};
|
|
175
|
+
// [i18n-Romanian] 罗马尼亚语
|
|
176
|
+
var _default = local;
|
|
177
177
|
exports.default = _default;
|
|
@@ -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
|
};
|
|
@@ -132,9 +132,32 @@ class Base extends _react.Component {
|
|
|
132
132
|
if (!rows || rows < 1) {
|
|
133
133
|
return false;
|
|
134
134
|
}
|
|
135
|
-
const updateOverflow = rows <= 1 ? this.
|
|
135
|
+
const updateOverflow = rows <= 1 ? this.compareSingleRow() : this.wrapperRef.current.scrollHeight > this.wrapperRef.current.offsetHeight;
|
|
136
136
|
return updateOverflow;
|
|
137
137
|
};
|
|
138
|
+
/**
|
|
139
|
+
* 通过将 content 给到 Range 对象,借助 Range 的 getBoundingClientRect 拿到 content 的准确 width
|
|
140
|
+
* 不受 css ellipsis 与否的影响
|
|
141
|
+
* By giving the content to the Range object, get the exact width of the content with the help of Range's getBoundingClientRect
|
|
142
|
+
* Not affected by css ellipsis or not
|
|
143
|
+
* https://github.com/DouyinFE/semi-design/issues/1731
|
|
144
|
+
*/
|
|
145
|
+
this.compareSingleRow = () => {
|
|
146
|
+
if (!(document && document.createRange)) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
const containerNode = this.wrapperRef.current;
|
|
150
|
+
const containerWidth = containerNode.getBoundingClientRect().width;
|
|
151
|
+
const childNodes = Array.from(containerNode.childNodes);
|
|
152
|
+
const range = document.createRange();
|
|
153
|
+
const contentWidth = childNodes.reduce((acc, node) => {
|
|
154
|
+
var _a;
|
|
155
|
+
range.selectNodeContents(node);
|
|
156
|
+
return acc + ((_a = range.getBoundingClientRect().width) !== null && _a !== void 0 ? _a : 0);
|
|
157
|
+
}, 0);
|
|
158
|
+
range.detach();
|
|
159
|
+
return contentWidth > containerWidth;
|
|
160
|
+
};
|
|
138
161
|
this.showTooltip = () => {
|
|
139
162
|
var _a, _b;
|
|
140
163
|
const {
|
|
@@ -241,14 +264,15 @@ class Base extends _react.Component {
|
|
|
241
264
|
expand: this.expandRef.current,
|
|
242
265
|
copy: this.copyRef && this.copyRef.current
|
|
243
266
|
};
|
|
244
|
-
const content = (0, _util.default)(this.wrapperRef.current, rows,
|
|
245
267
|
// Perform type conversion on children to prevent component crash due to non-string type of children
|
|
246
|
-
|
|
268
|
+
// https://github.com/DouyinFE/semi-design/issues/2167
|
|
269
|
+
const realChildren = Array.isArray(children) ? children.join('') : String(children);
|
|
270
|
+
const content = (0, _util.default)(this.wrapperRef.current, rows, realChildren, extraNode, ELLIPSIS_STR, suffix, pos);
|
|
247
271
|
return new Promise(resolve => {
|
|
248
272
|
this.setState({
|
|
249
273
|
isOverflowed: false,
|
|
250
274
|
ellipsisContent: content,
|
|
251
|
-
isTruncated:
|
|
275
|
+
isTruncated: realChildren !== content
|
|
252
276
|
}, resolve);
|
|
253
277
|
});
|
|
254
278
|
});
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -732,9 +732,9 @@ class Cascader extends BaseComponent {
|
|
|
732
732
|
}, []);
|
|
733
733
|
return formatKeys;
|
|
734
734
|
};
|
|
735
|
-
const needUpdateTreeData = needUpdate('treeData') || needUpdateData();
|
|
736
|
-
const needUpdateValue = needUpdate('value') || _isEmpty(prevProps) && defaultValue;
|
|
737
735
|
if (multiple) {
|
|
736
|
+
const needUpdateTreeData = needUpdate('treeData') || needUpdateData();
|
|
737
|
+
const needUpdateValue = needUpdate('value') || _isEmpty(prevProps) && defaultValue;
|
|
738
738
|
// when value and treedata need updated
|
|
739
739
|
if (needUpdateTreeData || needUpdateValue) {
|
|
740
740
|
// update state.keyEntities
|
|
@@ -782,8 +782,11 @@ class Cascader extends BaseComponent {
|
|
|
782
782
|
this.foundation.destroy();
|
|
783
783
|
}
|
|
784
784
|
componentDidUpdate(prevProps) {
|
|
785
|
+
if (this.props.multiple) {
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
785
788
|
let isOptionsChanged = false;
|
|
786
|
-
if (!_isEqual(prevProps.treeData, this.props.treeData)
|
|
789
|
+
if (!_isEqual(prevProps.treeData, this.props.treeData)) {
|
|
787
790
|
isOptionsChanged = true;
|
|
788
791
|
this.foundation.collectOptions();
|
|
789
792
|
}
|
|
@@ -1,170 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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;
|
|
@@ -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.
|
|
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
|
-
|
|
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:
|
|
266
|
+
isTruncated: realChildren !== content
|
|
243
267
|
}, resolve);
|
|
244
268
|
});
|
|
245
269
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.56.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
|
|
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
|
|
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": "
|
|
78
|
+
"gitHead": "df0bd1db35dc3e9fc6b78202ea2eb5d5d60e2256",
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
81
81
|
"@babel/plugin-transform-runtime": "^7.15.8",
|