@douyinfe/semi-ui 2.58.0-beta.0 → 2.58.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.
- package/dist/css/semi.css +108 -29
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +105 -31
- 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/_base/base.css +2 -2
- package/lib/cjs/button/Button.d.ts +1 -1
- package/lib/cjs/button/Button.js +1 -0
- package/lib/cjs/locale/interface.d.ts +3 -0
- package/lib/cjs/locale/source/ar.js +3 -0
- package/lib/cjs/locale/source/de.js +3 -0
- package/lib/cjs/locale/source/en_GB.js +3 -0
- package/lib/cjs/locale/source/en_US.js +3 -0
- package/lib/cjs/locale/source/es.js +3 -0
- package/lib/cjs/locale/source/fr.js +3 -0
- package/lib/cjs/locale/source/id_ID.js +3 -0
- package/lib/cjs/locale/source/it.js +3 -0
- package/lib/cjs/locale/source/ja_JP.js +3 -0
- package/lib/cjs/locale/source/ko_KR.js +3 -0
- package/lib/cjs/locale/source/ms_MY.js +3 -0
- package/lib/cjs/locale/source/nl_NL.js +3 -0
- package/lib/cjs/locale/source/pl_PL.js +3 -0
- package/lib/cjs/locale/source/pt_BR.js +3 -0
- package/lib/cjs/locale/source/ro.js +3 -0
- package/lib/cjs/locale/source/ru_RU.js +3 -0
- package/lib/cjs/locale/source/sv_SE.js +3 -0
- package/lib/cjs/locale/source/th_TH.js +3 -0
- package/lib/cjs/locale/source/tr_TR.js +3 -0
- package/lib/cjs/locale/source/vi_VN.js +3 -0
- package/lib/cjs/locale/source/zh_CN.js +3 -0
- package/lib/cjs/locale/source/zh_TW.js +3 -0
- package/lib/cjs/slider/index.js +13 -8
- package/lib/cjs/tabs/TabBar.d.ts +7 -0
- package/lib/cjs/tabs/TabBar.js +78 -18
- package/lib/cjs/tabs/TabItem.js +3 -1
- package/lib/cjs/tabs/index.d.ts +1 -0
- package/lib/cjs/tabs/index.js +7 -4
- package/lib/cjs/tabs/interface.d.ts +7 -0
- package/lib/es/_base/base.css +2 -2
- package/lib/es/button/Button.d.ts +1 -1
- package/lib/es/button/Button.js +1 -0
- package/lib/es/locale/interface.d.ts +3 -0
- package/lib/es/locale/source/ar.js +3 -0
- package/lib/es/locale/source/de.js +3 -0
- package/lib/es/locale/source/en_GB.js +3 -0
- package/lib/es/locale/source/en_US.js +3 -0
- package/lib/es/locale/source/es.js +3 -0
- package/lib/es/locale/source/fr.js +3 -0
- package/lib/es/locale/source/id_ID.js +3 -0
- package/lib/es/locale/source/it.js +3 -0
- package/lib/es/locale/source/ja_JP.js +3 -0
- package/lib/es/locale/source/ko_KR.js +3 -0
- package/lib/es/locale/source/ms_MY.js +3 -0
- package/lib/es/locale/source/nl_NL.js +3 -0
- package/lib/es/locale/source/pl_PL.js +3 -0
- package/lib/es/locale/source/pt_BR.js +3 -0
- package/lib/es/locale/source/ro.js +3 -0
- package/lib/es/locale/source/ru_RU.js +3 -0
- package/lib/es/locale/source/sv_SE.js +3 -0
- package/lib/es/locale/source/th_TH.js +3 -0
- package/lib/es/locale/source/tr_TR.js +3 -0
- package/lib/es/locale/source/vi_VN.js +3 -0
- package/lib/es/locale/source/zh_CN.js +3 -0
- package/lib/es/locale/source/zh_TW.js +3 -0
- package/lib/es/slider/index.js +13 -8
- package/lib/es/tabs/TabBar.d.ts +7 -0
- package/lib/es/tabs/TabBar.js +79 -19
- package/lib/es/tabs/TabItem.js +3 -1
- package/lib/es/tabs/index.d.ts +1 -0
- package/lib/es/tabs/index.js +7 -4
- package/lib/es/tabs/interface.d.ts +7 -0
- package/package.json +8 -8
package/lib/es/button/Button.js
CHANGED
|
@@ -51,6 +51,7 @@ export default class Button extends PureComponent {
|
|
|
51
51
|
[`${prefixCls}-block`]: block,
|
|
52
52
|
[`${prefixCls}-circle`]: circle,
|
|
53
53
|
[`${prefixCls}-borderless`]: theme === 'borderless',
|
|
54
|
+
[`${prefixCls}-outline`]: theme === "outline",
|
|
54
55
|
[`${prefixCls}-${type}-disabled`]: disabled && type
|
|
55
56
|
}, className),
|
|
56
57
|
type: htmlType,
|
package/lib/es/slider/index.js
CHANGED
|
@@ -266,11 +266,11 @@ export default class Slider extends BaseComponent {
|
|
|
266
266
|
const minPercent = percentInfo.min;
|
|
267
267
|
const maxPercent = percentInfo.max;
|
|
268
268
|
let trackStyle = !vertical ? {
|
|
269
|
-
width: range ? `${(maxPercent - minPercent) * 100}%` : `${minPercent * 100}%`,
|
|
270
|
-
left: range ? `${minPercent * 100}%` : 0
|
|
269
|
+
width: range ? `${Math.abs(maxPercent - minPercent) * 100}%` : `${minPercent * 100}%`,
|
|
270
|
+
left: range ? `${Math.min(minPercent, maxPercent) * 100}%` : 0
|
|
271
271
|
} : {
|
|
272
|
-
height: range ? `${(maxPercent - minPercent) * 100}%` : `${minPercent * 100}%`,
|
|
273
|
-
top: range ? `${minPercent * 100}%` : 0
|
|
272
|
+
height: range ? `${Math.abs(maxPercent - minPercent) * 100}%` : `${minPercent * 100}%`,
|
|
273
|
+
top: range ? `${Math.min(minPercent, maxPercent) * 100}%` : 0
|
|
274
274
|
};
|
|
275
275
|
trackStyle = included ? trackStyle : {};
|
|
276
276
|
return (
|
|
@@ -385,11 +385,13 @@ export default class Slider extends BaseComponent {
|
|
|
385
385
|
var _this = this;
|
|
386
386
|
return Object.assign(Object.assign({}, super.adapter), {
|
|
387
387
|
getSliderLengths: () => {
|
|
388
|
+
var _a;
|
|
388
389
|
if (this.sliderEl && this.sliderEl.current) {
|
|
389
390
|
const rect = this.sliderEl.current.getBoundingClientRect();
|
|
391
|
+
const offsetParentRect = (_a = this.sliderEl.current.offsetParent) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
390
392
|
const offset = {
|
|
391
|
-
x: this.sliderEl.current.offsetLeft,
|
|
392
|
-
y: this.sliderEl.current.offsetTop
|
|
393
|
+
x: offsetParentRect ? rect.left - offsetParentRect.left : this.sliderEl.current.offsetLeft,
|
|
394
|
+
y: offsetParentRect ? rect.top - offsetParentRect.top : this.sliderEl.current.offsetTop
|
|
393
395
|
};
|
|
394
396
|
return {
|
|
395
397
|
sliderX: offset.x,
|
|
@@ -446,7 +448,9 @@ export default class Slider extends BaseComponent {
|
|
|
446
448
|
let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _noop;
|
|
447
449
|
this.setState(stateObj, callback);
|
|
448
450
|
},
|
|
449
|
-
notifyChange: cbValue =>
|
|
451
|
+
notifyChange: cbValue => {
|
|
452
|
+
this.props.onChange(Array.isArray(cbValue) ? [...cbValue].sort() : cbValue);
|
|
453
|
+
},
|
|
450
454
|
setDragging: value => {
|
|
451
455
|
this.dragging = value;
|
|
452
456
|
},
|
|
@@ -599,7 +603,8 @@ export default class Slider extends BaseComponent {
|
|
|
599
603
|
[`${prefixCls}`]: !vertical,
|
|
600
604
|
[cssClasses.VERTICAL]: vertical
|
|
601
605
|
});
|
|
602
|
-
const
|
|
606
|
+
const fixedCurrentValue = Array.isArray(currentValue) ? [...currentValue].sort() : currentValue;
|
|
607
|
+
const ariaLabel = range ? `Range: ${this._getAriaValueText(fixedCurrentValue[0], 0)} to ${this._getAriaValueText(fixedCurrentValue[1], 1)}` : undefined;
|
|
603
608
|
const slider = /*#__PURE__*/React.createElement("div", Object.assign({
|
|
604
609
|
className: wrapperClass,
|
|
605
610
|
style: style,
|
package/lib/es/tabs/TabBar.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { DropdownProps } from '../dropdown';
|
|
3
4
|
import { TabBarProps, PlainTab } from './interface';
|
|
4
5
|
export interface TabBarState {
|
|
5
6
|
endInd: number;
|
|
@@ -25,19 +26,25 @@ declare class TabBar extends React.Component<TabBarProps, TabBarState> {
|
|
|
25
26
|
type: PropTypes.Requireable<string>;
|
|
26
27
|
closable: PropTypes.Requireable<boolean>;
|
|
27
28
|
deleteTabItem: PropTypes.Requireable<(...args: any[]) => any>;
|
|
29
|
+
more: PropTypes.Requireable<NonNullable<number | object>>;
|
|
28
30
|
};
|
|
29
31
|
constructor(props: TabBarProps);
|
|
30
32
|
componentDidMount(): void;
|
|
33
|
+
componentDidUpdate(prevProps: any): void;
|
|
31
34
|
renderIcon(icon: ReactNode): ReactNode;
|
|
32
35
|
renderExtra(): ReactNode;
|
|
33
36
|
handleItemClick: (itemKey: string, e: MouseEvent<Element>) => void;
|
|
34
37
|
handleKeyDown: (event: React.KeyboardEvent, itemKey: string, closable: boolean) => void;
|
|
35
38
|
renderTabItem: (panel: PlainTab) => ReactNode;
|
|
39
|
+
scrollTabItemIntoViewByKey: (key: string, logicalPosition?: ScrollLogicalPosition) => void;
|
|
40
|
+
scrollActiveTabItemIntoView: (logicalPosition?: ScrollLogicalPosition) => void;
|
|
36
41
|
renderTabComponents: (list: Array<PlainTab>) => Array<ReactNode>;
|
|
37
42
|
handleArrowClick: (items: Array<OverflowItem>, pos: 'start' | 'end') => void;
|
|
38
43
|
renderCollapse: (items: Array<OverflowItem>, icon: ReactNode, pos: 'start' | 'end') => ReactNode;
|
|
39
44
|
renderOverflow: (items: any[]) => Array<ReactNode>;
|
|
40
45
|
renderCollapsedTab: () => ReactNode;
|
|
46
|
+
renderWithMoreTrigger: () => ReactNode;
|
|
47
|
+
renderMoreDropdown: (panels: PlainTab[], dropDownProps: DropdownProps, trigger: ReactNode) => ReactNode;
|
|
41
48
|
render(): ReactNode;
|
|
42
49
|
private _isActive;
|
|
43
50
|
private _getItemKey;
|
package/lib/es/tabs/TabBar.js
CHANGED
|
@@ -16,23 +16,17 @@ import getDataAttr from '@douyinfe/semi-foundation/lib/es/utils/getDataAttr';
|
|
|
16
16
|
import OverflowList from '../overflowList';
|
|
17
17
|
import Dropdown from '../dropdown';
|
|
18
18
|
import Button from '../button';
|
|
19
|
-
import { IconChevronRight, IconChevronLeft } from '@douyinfe/semi-icons';
|
|
19
|
+
import { IconChevronRight, IconChevronLeft, IconChevronDown } from '@douyinfe/semi-icons';
|
|
20
20
|
import { getUuidv4 } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
|
|
21
21
|
import TabItem from './TabItem';
|
|
22
|
+
import LocaleConsumer from "../locale/localeConsumer";
|
|
22
23
|
class TabBar extends React.Component {
|
|
23
24
|
constructor(props) {
|
|
25
|
+
var _this;
|
|
24
26
|
super(props);
|
|
27
|
+
_this = this;
|
|
25
28
|
this.handleItemClick = (itemKey, e) => {
|
|
26
29
|
this.props.onTabClick(itemKey, e);
|
|
27
|
-
if (this.props.collapsible) {
|
|
28
|
-
const key = this._getItemKey(itemKey);
|
|
29
|
-
const tabItem = document.querySelector(`[data-uuid="${this.state.uuid}"] .${cssClasses.TABS_TAB}[data-scrollkey="${key}"]`);
|
|
30
|
-
tabItem.scrollIntoView({
|
|
31
|
-
behavior: 'smooth',
|
|
32
|
-
block: 'nearest',
|
|
33
|
-
inline: 'nearest'
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
30
|
};
|
|
37
31
|
this.handleKeyDown = (event, itemKey, closable) => {
|
|
38
32
|
this.props.handleKeyDown(event, itemKey, closable);
|
|
@@ -57,6 +51,19 @@ class TabBar extends React.Component {
|
|
|
57
51
|
onClick: this.handleItemClick
|
|
58
52
|
}));
|
|
59
53
|
};
|
|
54
|
+
this.scrollTabItemIntoViewByKey = function (key) {
|
|
55
|
+
let logicalPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'nearest';
|
|
56
|
+
const tabItem = document.querySelector(`[data-uuid="${_this.state.uuid}"] .${cssClasses.TABS_TAB}[data-scrollkey="${key}"]`);
|
|
57
|
+
tabItem === null || tabItem === void 0 ? void 0 : tabItem.scrollIntoView({
|
|
58
|
+
behavior: 'smooth',
|
|
59
|
+
block: logicalPosition,
|
|
60
|
+
inline: logicalPosition
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
this.scrollActiveTabItemIntoView = logicalPosition => {
|
|
64
|
+
const key = this._getItemKey(this.props.activeKey);
|
|
65
|
+
this.scrollTabItemIntoViewByKey(key, logicalPosition);
|
|
66
|
+
};
|
|
60
67
|
this.renderTabComponents = list => list.map(panel => this.renderTabItem(panel));
|
|
61
68
|
this.handleArrowClick = (items, pos) => {
|
|
62
69
|
const lastItem = pos === 'start' ? items.pop() : items.shift();
|
|
@@ -64,12 +71,7 @@ class TabBar extends React.Component {
|
|
|
64
71
|
return;
|
|
65
72
|
}
|
|
66
73
|
const key = this._getItemKey(lastItem.itemKey);
|
|
67
|
-
|
|
68
|
-
tabItem.scrollIntoView({
|
|
69
|
-
behavior: 'smooth',
|
|
70
|
-
block: 'nearest',
|
|
71
|
-
inline: 'nearest'
|
|
72
|
-
});
|
|
74
|
+
this.scrollTabItemIntoViewByKey(key);
|
|
73
75
|
};
|
|
74
76
|
this.renderCollapse = (items, icon, pos) => {
|
|
75
77
|
if (_isEmpty(items)) {
|
|
@@ -156,6 +158,55 @@ class TabBar extends React.Component {
|
|
|
156
158
|
visibleItemRenderer: this.renderTabItem
|
|
157
159
|
});
|
|
158
160
|
};
|
|
161
|
+
this.renderWithMoreTrigger = () => {
|
|
162
|
+
const {
|
|
163
|
+
list,
|
|
164
|
+
more
|
|
165
|
+
} = this.props;
|
|
166
|
+
let tabElements = [];
|
|
167
|
+
let moreTrigger = /*#__PURE__*/React.createElement("div", {
|
|
168
|
+
className: cls({
|
|
169
|
+
[`${cssClasses.TABS_BAR}-more-trigger`]: true,
|
|
170
|
+
[`${cssClasses.TABS_BAR}-more-trigger-${this.props.type}`]: true
|
|
171
|
+
})
|
|
172
|
+
}, /*#__PURE__*/React.createElement(LocaleConsumer, {
|
|
173
|
+
componentName: "Tabs"
|
|
174
|
+
}, (locale, localeCode) => /*#__PURE__*/React.createElement("div", {
|
|
175
|
+
className: `${cssClasses.TABS_BAR}-more-trigger-content`
|
|
176
|
+
}, /*#__PURE__*/React.createElement("div", null, locale.more), /*#__PURE__*/React.createElement(IconChevronDown, {
|
|
177
|
+
className: `${cssClasses.TABS_BAR}-more-trigger-content-icon`
|
|
178
|
+
}))));
|
|
179
|
+
let keepCount;
|
|
180
|
+
if (typeof more === "number") {
|
|
181
|
+
keepCount = list.length - Math.min(more, list.length);
|
|
182
|
+
tabElements = list.slice(0, keepCount).map(panel => this.renderTabItem(panel));
|
|
183
|
+
} else if (typeof more === 'object') {
|
|
184
|
+
keepCount = list.length - Math.min(more.count, list.length);
|
|
185
|
+
tabElements = list.slice(0, keepCount).map(panel => this.renderTabItem(panel));
|
|
186
|
+
if (more.render) {
|
|
187
|
+
moreTrigger = more.render();
|
|
188
|
+
}
|
|
189
|
+
} else if (more !== undefined) {
|
|
190
|
+
throw new Error("[Semi Tabs]: invalid tab props format: more");
|
|
191
|
+
}
|
|
192
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, tabElements, this.renderMoreDropdown(list.slice(keepCount), more === null || more === void 0 ? void 0 : more['dropdownProps'], moreTrigger));
|
|
193
|
+
};
|
|
194
|
+
this.renderMoreDropdown = (panels, dropDownProps, trigger) => {
|
|
195
|
+
return /*#__PURE__*/React.createElement(Dropdown, Object.assign({
|
|
196
|
+
trigger: 'hover',
|
|
197
|
+
showTick: true,
|
|
198
|
+
position: 'bottomLeft',
|
|
199
|
+
className: `${cssClasses.TABS_BAR}-more-dropdown-${this.props.type}`,
|
|
200
|
+
clickToHide: true,
|
|
201
|
+
menu: panels.map(panel => ({
|
|
202
|
+
node: 'item',
|
|
203
|
+
name: panel.tab,
|
|
204
|
+
icon: panel.icon,
|
|
205
|
+
onClick: e => this.props.onTabClick(panel.itemKey, e),
|
|
206
|
+
active: this.props.activeKey === panel.itemKey
|
|
207
|
+
}))
|
|
208
|
+
}, dropDownProps), trigger);
|
|
209
|
+
};
|
|
159
210
|
this._isActive = key => key === this.props.activeKey;
|
|
160
211
|
this._getItemKey = key => `${key}-bar`;
|
|
161
212
|
this.state = {
|
|
@@ -170,6 +221,13 @@ class TabBar extends React.Component {
|
|
|
170
221
|
uuid: getUuidv4()
|
|
171
222
|
});
|
|
172
223
|
}
|
|
224
|
+
componentDidUpdate(prevProps) {
|
|
225
|
+
if (prevProps.activeKey !== this.props.activeKey) {
|
|
226
|
+
if (this.props.collapsible) {
|
|
227
|
+
this.scrollActiveTabItemIntoView();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
173
231
|
renderIcon(icon) {
|
|
174
232
|
return /*#__PURE__*/React.createElement("span", null, icon);
|
|
175
233
|
}
|
|
@@ -205,9 +263,10 @@ class TabBar extends React.Component {
|
|
|
205
263
|
className,
|
|
206
264
|
list,
|
|
207
265
|
tabPosition,
|
|
266
|
+
more,
|
|
208
267
|
collapsible
|
|
209
268
|
} = _a,
|
|
210
|
-
restProps = __rest(_a, ["type", "style", "className", "list", "tabPosition", "collapsible"]);
|
|
269
|
+
restProps = __rest(_a, ["type", "style", "className", "list", "tabPosition", "more", "collapsible"]);
|
|
211
270
|
const classNames = cls(className, {
|
|
212
271
|
[cssClasses.TABS_BAR]: true,
|
|
213
272
|
[cssClasses.TABS_BAR_LINE]: type === 'line',
|
|
@@ -217,7 +276,7 @@ class TabBar extends React.Component {
|
|
|
217
276
|
[`${cssClasses.TABS_BAR}-collapse`]: collapsible
|
|
218
277
|
});
|
|
219
278
|
const extra = this.renderExtra();
|
|
220
|
-
const contents = collapsible ? this.renderCollapsedTab() : this.renderTabComponents(list);
|
|
279
|
+
const contents = collapsible ? this.renderCollapsedTab() : more ? this.renderWithMoreTrigger() : this.renderTabComponents(list);
|
|
221
280
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
222
281
|
role: "tablist",
|
|
223
282
|
"aria-orientation": tabPosition === "left" ? "vertical" : "horizontal",
|
|
@@ -240,6 +299,7 @@ TabBar.propTypes = {
|
|
|
240
299
|
tabPosition: PropTypes.oneOf(strings.POSITION_MAP),
|
|
241
300
|
type: PropTypes.oneOf(strings.TYPE_MAP),
|
|
242
301
|
closable: PropTypes.bool,
|
|
243
|
-
deleteTabItem: PropTypes.func
|
|
302
|
+
deleteTabItem: PropTypes.func,
|
|
303
|
+
more: PropTypes.oneOfType([PropTypes.number, PropTypes.object])
|
|
244
304
|
};
|
|
245
305
|
export default TabBar;
|
package/lib/es/tabs/TabItem.js
CHANGED
|
@@ -34,7 +34,9 @@ const TabItem = (props, ref) => {
|
|
|
34
34
|
onClick: e => deleteTabItem(itemKey, e)
|
|
35
35
|
}) : null;
|
|
36
36
|
}, [type, closable, deleteTabItem, itemKey]);
|
|
37
|
-
const renderIcon = useCallback(icon => /*#__PURE__*/React.createElement("span",
|
|
37
|
+
const renderIcon = useCallback(icon => /*#__PURE__*/React.createElement("span", {
|
|
38
|
+
className: `${cssClasses.TABS_BAR}-icon`
|
|
39
|
+
}, icon), []);
|
|
38
40
|
const handleKeyDownInItem = useCallback(event => {
|
|
39
41
|
handleKeyDown && handleKeyDown(event, itemKey, closable);
|
|
40
42
|
}, [handleKeyDown, itemKey, closable]);
|
package/lib/es/tabs/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ declare class Tabs extends BaseComponent<TabsProps, TabsState> {
|
|
|
37
37
|
type: PropTypes.Requireable<string>;
|
|
38
38
|
onTabClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
39
|
preventScroll: PropTypes.Requireable<boolean>;
|
|
40
|
+
more: PropTypes.Requireable<NonNullable<number | object>>;
|
|
40
41
|
};
|
|
41
42
|
static __SemiComponentName__: string;
|
|
42
43
|
static defaultProps: TabsProps;
|
package/lib/es/tabs/index.js
CHANGED
|
@@ -222,9 +222,10 @@ class Tabs extends BaseComponent {
|
|
|
222
222
|
tabBarStyle,
|
|
223
223
|
tabPaneMotion,
|
|
224
224
|
tabPosition,
|
|
225
|
-
type
|
|
225
|
+
type,
|
|
226
|
+
more
|
|
226
227
|
} = _a,
|
|
227
|
-
restProps = __rest(_a, ["children", "className", "collapsible", "contentStyle", "keepDOM", "lazyRender", "renderTabBar", "size", "style", "tabBarClassName", "tabBarExtraContent", "tabBarStyle", "tabPaneMotion", "tabPosition", "type"]);
|
|
228
|
+
restProps = __rest(_a, ["children", "className", "collapsible", "contentStyle", "keepDOM", "lazyRender", "renderTabBar", "size", "style", "tabBarClassName", "tabBarExtraContent", "tabBarStyle", "tabPaneMotion", "tabPosition", "type", "more"]);
|
|
228
229
|
const {
|
|
229
230
|
panes,
|
|
230
231
|
activeKey
|
|
@@ -249,7 +250,8 @@ class Tabs extends BaseComponent {
|
|
|
249
250
|
tabPosition,
|
|
250
251
|
type,
|
|
251
252
|
deleteTabItem: this.deleteTabItem,
|
|
252
|
-
handleKeyDown: this.foundation.handleKeyDown
|
|
253
|
+
handleKeyDown: this.foundation.handleKeyDown,
|
|
254
|
+
more
|
|
253
255
|
};
|
|
254
256
|
const tabBar = renderTabBar ? renderTabBar(tabBarProps, TabBar) : /*#__PURE__*/React.createElement(TabBar, Object.assign({}, tabBarProps));
|
|
255
257
|
const content = keepDOM ? children : this.getActiveItem();
|
|
@@ -296,7 +298,8 @@ Tabs.propTypes = {
|
|
|
296
298
|
tabPosition: PropTypes.oneOf(strings.POSITION_MAP),
|
|
297
299
|
type: PropTypes.oneOf(strings.TYPE_MAP),
|
|
298
300
|
onTabClose: PropTypes.func,
|
|
299
|
-
preventScroll: PropTypes.bool
|
|
301
|
+
preventScroll: PropTypes.bool,
|
|
302
|
+
more: PropTypes.oneOfType([PropTypes.number, PropTypes.object])
|
|
300
303
|
};
|
|
301
304
|
Tabs.__SemiComponentName__ = "Tabs";
|
|
302
305
|
Tabs.defaultProps = getDefaultPropsFromGlobalConfig(Tabs.__SemiComponentName__, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { CSSProperties, MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import { Motion } from '../_base/base';
|
|
3
3
|
import TabBar from './TabBar';
|
|
4
|
+
import { DropdownProps } from "../dropdown";
|
|
4
5
|
export type TabType = 'line' | 'card' | 'button';
|
|
5
6
|
export type TabSize = 'small' | 'medium' | 'large';
|
|
6
7
|
export type TabPosition = 'top' | 'left';
|
|
@@ -34,6 +35,11 @@ export interface TabsProps {
|
|
|
34
35
|
type?: TabType;
|
|
35
36
|
onTabClose?: (tabKey: string) => void;
|
|
36
37
|
preventScroll?: boolean;
|
|
38
|
+
more?: number | {
|
|
39
|
+
count: number;
|
|
40
|
+
render?: () => ReactNode;
|
|
41
|
+
dropdownProps?: DropdownProps;
|
|
42
|
+
};
|
|
37
43
|
}
|
|
38
44
|
export interface TabBarProps {
|
|
39
45
|
activeKey?: string;
|
|
@@ -51,6 +57,7 @@ export interface TabBarProps {
|
|
|
51
57
|
closable?: boolean;
|
|
52
58
|
deleteTabItem?: (tabKey: string, event: MouseEvent<Element>) => void;
|
|
53
59
|
handleKeyDown?: (event: React.KeyboardEvent, itemKey: string, closable: boolean) => void;
|
|
60
|
+
more?: TabsProps['more'];
|
|
54
61
|
}
|
|
55
62
|
export interface TabPaneProps {
|
|
56
63
|
className?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.58.
|
|
3
|
+
"version": "2.58.1",
|
|
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.58.
|
|
24
|
-
"@douyinfe/semi-animation-react": "2.58.
|
|
25
|
-
"@douyinfe/semi-foundation": "2.58.
|
|
26
|
-
"@douyinfe/semi-icons": "2.58.
|
|
27
|
-
"@douyinfe/semi-illustrations": "2.58.
|
|
28
|
-
"@douyinfe/semi-theme-default": "2.58.
|
|
23
|
+
"@douyinfe/semi-animation": "2.58.1",
|
|
24
|
+
"@douyinfe/semi-animation-react": "2.58.1",
|
|
25
|
+
"@douyinfe/semi-foundation": "2.58.1",
|
|
26
|
+
"@douyinfe/semi-icons": "2.58.1",
|
|
27
|
+
"@douyinfe/semi-illustrations": "2.58.1",
|
|
28
|
+
"@douyinfe/semi-theme-default": "2.58.1",
|
|
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": "1e48bf7b71e78f49b188ff82c5ab61884a6ec0ab",
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
81
81
|
"@babel/plugin-transform-runtime": "^7.15.8",
|