@douyinfe/semi-ui 2.58.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 +23 -20
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +23 -15
- 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/tabs/TabBar.d.ts +3 -0
- package/lib/cjs/tabs/TabBar.js +23 -15
- package/lib/es/tabs/TabBar.d.ts +3 -0
- package/lib/es/tabs/TabBar.js +23 -15
- package/package.json +8 -8
package/dist/umd/semi-ui.js
CHANGED
|
@@ -84959,18 +84959,11 @@ var TabBar_rest = undefined && undefined.__rest || function (s, e) {
|
|
|
84959
84959
|
|
|
84960
84960
|
class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Component {
|
|
84961
84961
|
constructor(props) {
|
|
84962
|
+
var _this;
|
|
84962
84963
|
super(props);
|
|
84964
|
+
_this = this;
|
|
84963
84965
|
this.handleItemClick = (itemKey, e) => {
|
|
84964
84966
|
this.props.onTabClick(itemKey, e);
|
|
84965
|
-
if (this.props.collapsible) {
|
|
84966
|
-
const key = this._getItemKey(itemKey);
|
|
84967
|
-
const tabItem = document.querySelector(`[data-uuid="${this.state.uuid}"] .${tabs_constants_cssClasses.TABS_TAB}[data-scrollkey="${key}"]`);
|
|
84968
|
-
tabItem.scrollIntoView({
|
|
84969
|
-
behavior: 'smooth',
|
|
84970
|
-
block: 'nearest',
|
|
84971
|
-
inline: 'nearest'
|
|
84972
|
-
});
|
|
84973
|
-
}
|
|
84974
84967
|
};
|
|
84975
84968
|
this.handleKeyDown = (event, itemKey, closable) => {
|
|
84976
84969
|
this.props.handleKeyDown(event, itemKey, closable);
|
|
@@ -84995,6 +84988,19 @@ class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_rea
|
|
|
84995
84988
|
onClick: this.handleItemClick
|
|
84996
84989
|
}));
|
|
84997
84990
|
};
|
|
84991
|
+
this.scrollTabItemIntoViewByKey = function (key) {
|
|
84992
|
+
let logicalPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'nearest';
|
|
84993
|
+
const tabItem = document.querySelector(`[data-uuid="${_this.state.uuid}"] .${tabs_constants_cssClasses.TABS_TAB}[data-scrollkey="${key}"]`);
|
|
84994
|
+
tabItem === null || tabItem === void 0 ? void 0 : tabItem.scrollIntoView({
|
|
84995
|
+
behavior: 'smooth',
|
|
84996
|
+
block: logicalPosition,
|
|
84997
|
+
inline: logicalPosition
|
|
84998
|
+
});
|
|
84999
|
+
};
|
|
85000
|
+
this.scrollActiveTabItemIntoView = logicalPosition => {
|
|
85001
|
+
const key = this._getItemKey(this.props.activeKey);
|
|
85002
|
+
this.scrollTabItemIntoViewByKey(key, logicalPosition);
|
|
85003
|
+
};
|
|
84998
85004
|
this.renderTabComponents = list => list.map(panel => this.renderTabItem(panel));
|
|
84999
85005
|
this.handleArrowClick = (items, pos) => {
|
|
85000
85006
|
const lastItem = pos === 'start' ? items.pop() : items.shift();
|
|
@@ -85002,12 +85008,7 @@ class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_rea
|
|
|
85002
85008
|
return;
|
|
85003
85009
|
}
|
|
85004
85010
|
const key = this._getItemKey(lastItem.itemKey);
|
|
85005
|
-
|
|
85006
|
-
tabItem.scrollIntoView({
|
|
85007
|
-
behavior: 'smooth',
|
|
85008
|
-
block: 'nearest',
|
|
85009
|
-
inline: 'nearest'
|
|
85010
|
-
});
|
|
85011
|
+
this.scrollTabItemIntoViewByKey(key);
|
|
85011
85012
|
};
|
|
85012
85013
|
this.renderCollapse = (items, icon, pos) => {
|
|
85013
85014
|
if (isEmpty_default()(items)) {
|
|
@@ -85157,6 +85158,13 @@ class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_rea
|
|
|
85157
85158
|
uuid: getUuidv4()
|
|
85158
85159
|
});
|
|
85159
85160
|
}
|
|
85161
|
+
componentDidUpdate(prevProps) {
|
|
85162
|
+
if (prevProps.activeKey !== this.props.activeKey) {
|
|
85163
|
+
if (this.props.collapsible) {
|
|
85164
|
+
this.scrollActiveTabItemIntoView();
|
|
85165
|
+
}
|
|
85166
|
+
}
|
|
85167
|
+
}
|
|
85160
85168
|
renderIcon(icon) {
|
|
85161
85169
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", null, icon);
|
|
85162
85170
|
}
|