@douyinfe/semi-ui 2.58.0-beta.0 → 2.58.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 +85 -9
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +82 -16
- 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 +4 -0
- package/lib/cjs/tabs/TabBar.js +55 -3
- 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 +4 -0
- package/lib/es/tabs/TabBar.js +56 -4
- 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/dist/umd/semi-ui.js
CHANGED
|
@@ -21460,6 +21460,9 @@ const local = {
|
|
|
21460
21460
|
confirm: '确定',
|
|
21461
21461
|
cancel: '取消'
|
|
21462
21462
|
},
|
|
21463
|
+
Tabs: {
|
|
21464
|
+
more: "更多"
|
|
21465
|
+
},
|
|
21463
21466
|
TimePicker: {
|
|
21464
21467
|
placeholder: {
|
|
21465
21468
|
time: '请选择时间',
|
|
@@ -27929,6 +27932,7 @@ class Button_Button extends external_root_React_commonjs2_react_commonjs_react_a
|
|
|
27929
27932
|
[`${prefixCls}-block`]: block,
|
|
27930
27933
|
[`${prefixCls}-circle`]: circle,
|
|
27931
27934
|
[`${prefixCls}-borderless`]: theme === 'borderless',
|
|
27935
|
+
[`${prefixCls}-outline`]: theme === "outline",
|
|
27932
27936
|
[`${prefixCls}-${type}-disabled`]: disabled && type
|
|
27933
27937
|
}, className),
|
|
27934
27938
|
type: htmlType,
|
|
@@ -76644,11 +76648,11 @@ class Slider extends BaseComponent {
|
|
|
76644
76648
|
const minPercent = percentInfo.min;
|
|
76645
76649
|
const maxPercent = percentInfo.max;
|
|
76646
76650
|
let trackStyle = !vertical ? {
|
|
76647
|
-
width: range ? `${(maxPercent - minPercent) * 100}%` : `${minPercent * 100}%`,
|
|
76648
|
-
left: range ? `${minPercent * 100}%` : 0
|
|
76651
|
+
width: range ? `${Math.abs(maxPercent - minPercent) * 100}%` : `${minPercent * 100}%`,
|
|
76652
|
+
left: range ? `${Math.min(minPercent, maxPercent) * 100}%` : 0
|
|
76649
76653
|
} : {
|
|
76650
|
-
height: range ? `${(maxPercent - minPercent) * 100}%` : `${minPercent * 100}%`,
|
|
76651
|
-
top: range ? `${minPercent * 100}%` : 0
|
|
76654
|
+
height: range ? `${Math.abs(maxPercent - minPercent) * 100}%` : `${minPercent * 100}%`,
|
|
76655
|
+
top: range ? `${Math.min(minPercent, maxPercent) * 100}%` : 0
|
|
76652
76656
|
};
|
|
76653
76657
|
trackStyle = included ? trackStyle : {};
|
|
76654
76658
|
return (
|
|
@@ -76763,11 +76767,13 @@ class Slider extends BaseComponent {
|
|
|
76763
76767
|
var _this = this;
|
|
76764
76768
|
return Object.assign(Object.assign({}, super.adapter), {
|
|
76765
76769
|
getSliderLengths: () => {
|
|
76770
|
+
var _a;
|
|
76766
76771
|
if (this.sliderEl && this.sliderEl.current) {
|
|
76767
76772
|
const rect = this.sliderEl.current.getBoundingClientRect();
|
|
76773
|
+
const offsetParentRect = (_a = this.sliderEl.current.offsetParent) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
76768
76774
|
const offset = {
|
|
76769
|
-
x: this.sliderEl.current.offsetLeft,
|
|
76770
|
-
y: this.sliderEl.current.offsetTop
|
|
76775
|
+
x: offsetParentRect ? rect.left - offsetParentRect.left : this.sliderEl.current.offsetLeft,
|
|
76776
|
+
y: offsetParentRect ? rect.top - offsetParentRect.top : this.sliderEl.current.offsetTop
|
|
76771
76777
|
};
|
|
76772
76778
|
return {
|
|
76773
76779
|
sliderX: offset.x,
|
|
@@ -76824,7 +76830,9 @@ class Slider extends BaseComponent {
|
|
|
76824
76830
|
let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (noop_default());
|
|
76825
76831
|
this.setState(stateObj, callback);
|
|
76826
76832
|
},
|
|
76827
|
-
notifyChange: cbValue =>
|
|
76833
|
+
notifyChange: cbValue => {
|
|
76834
|
+
this.props.onChange(Array.isArray(cbValue) ? [...cbValue].sort() : cbValue);
|
|
76835
|
+
},
|
|
76828
76836
|
setDragging: value => {
|
|
76829
76837
|
this.dragging = value;
|
|
76830
76838
|
},
|
|
@@ -76977,7 +76985,8 @@ class Slider extends BaseComponent {
|
|
|
76977
76985
|
[`${slider_prefixCls}`]: !vertical,
|
|
76978
76986
|
[slider_constants_cssClasses.VERTICAL]: vertical
|
|
76979
76987
|
});
|
|
76980
|
-
const
|
|
76988
|
+
const fixedCurrentValue = Array.isArray(currentValue) ? [...currentValue].sort() : currentValue;
|
|
76989
|
+
const ariaLabel = range ? `Range: ${this._getAriaValueText(fixedCurrentValue[0], 0)} to ${this._getAriaValueText(fixedCurrentValue[1], 1)}` : undefined;
|
|
76981
76990
|
const slider = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", Object.assign({
|
|
76982
76991
|
className: wrapperClass,
|
|
76983
76992
|
style: style,
|
|
@@ -84887,7 +84896,9 @@ const TabItem = (props, ref) => {
|
|
|
84887
84896
|
onClick: e => deleteTabItem(itemKey, e)
|
|
84888
84897
|
}) : null;
|
|
84889
84898
|
}, [type, closable, deleteTabItem, itemKey]);
|
|
84890
|
-
const renderIcon = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(icon => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span",
|
|
84899
|
+
const renderIcon = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(icon => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
84900
|
+
className: `${tabs_constants_cssClasses.TABS_BAR}-icon`
|
|
84901
|
+
}, icon), []);
|
|
84891
84902
|
const handleKeyDownInItem = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(event => {
|
|
84892
84903
|
handleKeyDown && handleKeyDown(event, itemKey, closable);
|
|
84893
84904
|
}, [handleKeyDown, itemKey, closable]);
|
|
@@ -84945,6 +84956,7 @@ var TabBar_rest = undefined && undefined.__rest || function (s, e) {
|
|
|
84945
84956
|
|
|
84946
84957
|
|
|
84947
84958
|
|
|
84959
|
+
|
|
84948
84960
|
class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Component {
|
|
84949
84961
|
constructor(props) {
|
|
84950
84962
|
super(props);
|
|
@@ -85082,6 +85094,55 @@ class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_rea
|
|
|
85082
85094
|
visibleItemRenderer: this.renderTabItem
|
|
85083
85095
|
});
|
|
85084
85096
|
};
|
|
85097
|
+
this.renderWithMoreTrigger = () => {
|
|
85098
|
+
const {
|
|
85099
|
+
list,
|
|
85100
|
+
more
|
|
85101
|
+
} = this.props;
|
|
85102
|
+
let tabElements = [];
|
|
85103
|
+
let moreTrigger = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
85104
|
+
className: classnames_default()({
|
|
85105
|
+
[`${tabs_constants_cssClasses.TABS_BAR}-more-trigger`]: true,
|
|
85106
|
+
[`${tabs_constants_cssClasses.TABS_BAR}-more-trigger-${this.props.type}`]: true
|
|
85107
|
+
})
|
|
85108
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(LocaleConsumer, {
|
|
85109
|
+
componentName: "Tabs"
|
|
85110
|
+
}, (locale, localeCode) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
85111
|
+
className: `${tabs_constants_cssClasses.TABS_BAR}-more-trigger-content`
|
|
85112
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", null, locale.more), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(IconChevronDown, {
|
|
85113
|
+
className: `${tabs_constants_cssClasses.TABS_BAR}-more-trigger-content-icon`
|
|
85114
|
+
}))));
|
|
85115
|
+
let keepCount;
|
|
85116
|
+
if (typeof more === "number") {
|
|
85117
|
+
keepCount = list.length - Math.min(more, list.length);
|
|
85118
|
+
tabElements = list.slice(0, keepCount).map(panel => this.renderTabItem(panel));
|
|
85119
|
+
} else if (typeof more === 'object') {
|
|
85120
|
+
keepCount = list.length - Math.min(more.count, list.length);
|
|
85121
|
+
tabElements = list.slice(0, keepCount).map(panel => this.renderTabItem(panel));
|
|
85122
|
+
if (more.render) {
|
|
85123
|
+
moreTrigger = more.render();
|
|
85124
|
+
}
|
|
85125
|
+
} else if (more !== undefined) {
|
|
85126
|
+
throw new Error("[Semi Tabs]: invalid tab props format: more");
|
|
85127
|
+
}
|
|
85128
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, tabElements, this.renderMoreDropdown(list.slice(keepCount), more === null || more === void 0 ? void 0 : more['dropdownProps'], moreTrigger));
|
|
85129
|
+
};
|
|
85130
|
+
this.renderMoreDropdown = (panels, dropDownProps, trigger) => {
|
|
85131
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(dropdown_0, Object.assign({
|
|
85132
|
+
trigger: 'hover',
|
|
85133
|
+
showTick: true,
|
|
85134
|
+
position: 'bottomLeft',
|
|
85135
|
+
className: `${tabs_constants_cssClasses.TABS_BAR}-more-dropdown-${this.props.type}`,
|
|
85136
|
+
clickToHide: true,
|
|
85137
|
+
menu: panels.map(panel => ({
|
|
85138
|
+
node: 'item',
|
|
85139
|
+
name: panel.tab,
|
|
85140
|
+
icon: panel.icon,
|
|
85141
|
+
onClick: e => this.props.onTabClick(panel.itemKey, e),
|
|
85142
|
+
active: this.props.activeKey === panel.itemKey
|
|
85143
|
+
}))
|
|
85144
|
+
}, dropDownProps), trigger);
|
|
85145
|
+
};
|
|
85085
85146
|
this._isActive = key => key === this.props.activeKey;
|
|
85086
85147
|
this._getItemKey = key => `${key}-bar`;
|
|
85087
85148
|
this.state = {
|
|
@@ -85131,9 +85192,10 @@ class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_rea
|
|
|
85131
85192
|
className,
|
|
85132
85193
|
list,
|
|
85133
85194
|
tabPosition,
|
|
85195
|
+
more,
|
|
85134
85196
|
collapsible
|
|
85135
85197
|
} = _a,
|
|
85136
|
-
restProps = TabBar_rest(_a, ["type", "style", "className", "list", "tabPosition", "collapsible"]);
|
|
85198
|
+
restProps = TabBar_rest(_a, ["type", "style", "className", "list", "tabPosition", "more", "collapsible"]);
|
|
85137
85199
|
const classNames = classnames_default()(className, {
|
|
85138
85200
|
[tabs_constants_cssClasses.TABS_BAR]: true,
|
|
85139
85201
|
[tabs_constants_cssClasses.TABS_BAR_LINE]: type === 'line',
|
|
@@ -85143,7 +85205,7 @@ class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_rea
|
|
|
85143
85205
|
[`${tabs_constants_cssClasses.TABS_BAR}-collapse`]: collapsible
|
|
85144
85206
|
});
|
|
85145
85207
|
const extra = this.renderExtra();
|
|
85146
|
-
const contents = collapsible ? this.renderCollapsedTab() : this.renderTabComponents(list);
|
|
85208
|
+
const contents = collapsible ? this.renderCollapsedTab() : more ? this.renderWithMoreTrigger() : this.renderTabComponents(list);
|
|
85147
85209
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", Object.assign({
|
|
85148
85210
|
role: "tablist",
|
|
85149
85211
|
"aria-orientation": tabPosition === "left" ? "vertical" : "horizontal",
|
|
@@ -85166,7 +85228,8 @@ TabBar.propTypes = {
|
|
|
85166
85228
|
tabPosition: prop_types_default().oneOf(tabs_constants_strings.POSITION_MAP),
|
|
85167
85229
|
type: prop_types_default().oneOf(tabs_constants_strings.TYPE_MAP),
|
|
85168
85230
|
closable: (prop_types_default()).bool,
|
|
85169
|
-
deleteTabItem: (prop_types_default()).func
|
|
85231
|
+
deleteTabItem: (prop_types_default()).func,
|
|
85232
|
+
more: prop_types_default().oneOfType([(prop_types_default()).number, (prop_types_default()).object])
|
|
85170
85233
|
};
|
|
85171
85234
|
/* harmony default export */ const tabs_TabBar = (TabBar);
|
|
85172
85235
|
;// CONCATENATED MODULE: ./tabs/tabs-context.ts
|
|
@@ -85525,9 +85588,10 @@ class Tabs extends BaseComponent {
|
|
|
85525
85588
|
tabBarStyle,
|
|
85526
85589
|
tabPaneMotion,
|
|
85527
85590
|
tabPosition,
|
|
85528
|
-
type
|
|
85591
|
+
type,
|
|
85592
|
+
more
|
|
85529
85593
|
} = _a,
|
|
85530
|
-
restProps = tabs_rest(_a, ["children", "className", "collapsible", "contentStyle", "keepDOM", "lazyRender", "renderTabBar", "size", "style", "tabBarClassName", "tabBarExtraContent", "tabBarStyle", "tabPaneMotion", "tabPosition", "type"]);
|
|
85594
|
+
restProps = tabs_rest(_a, ["children", "className", "collapsible", "contentStyle", "keepDOM", "lazyRender", "renderTabBar", "size", "style", "tabBarClassName", "tabBarExtraContent", "tabBarStyle", "tabPaneMotion", "tabPosition", "type", "more"]);
|
|
85531
85595
|
const {
|
|
85532
85596
|
panes,
|
|
85533
85597
|
activeKey
|
|
@@ -85552,7 +85616,8 @@ class Tabs extends BaseComponent {
|
|
|
85552
85616
|
tabPosition,
|
|
85553
85617
|
type,
|
|
85554
85618
|
deleteTabItem: this.deleteTabItem,
|
|
85555
|
-
handleKeyDown: this.foundation.handleKeyDown
|
|
85619
|
+
handleKeyDown: this.foundation.handleKeyDown,
|
|
85620
|
+
more
|
|
85556
85621
|
};
|
|
85557
85622
|
const tabBar = renderTabBar ? renderTabBar(tabBarProps, tabs_TabBar) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(tabs_TabBar, Object.assign({}, tabBarProps));
|
|
85558
85623
|
const content = keepDOM ? children : this.getActiveItem();
|
|
@@ -85599,7 +85664,8 @@ Tabs.propTypes = {
|
|
|
85599
85664
|
tabPosition: prop_types_default().oneOf(tabs_constants_strings.POSITION_MAP),
|
|
85600
85665
|
type: prop_types_default().oneOf(tabs_constants_strings.TYPE_MAP),
|
|
85601
85666
|
onTabClose: (prop_types_default()).func,
|
|
85602
|
-
preventScroll: (prop_types_default()).bool
|
|
85667
|
+
preventScroll: (prop_types_default()).bool,
|
|
85668
|
+
more: prop_types_default().oneOfType([(prop_types_default()).number, (prop_types_default()).object])
|
|
85603
85669
|
};
|
|
85604
85670
|
Tabs.__SemiComponentName__ = "Tabs";
|
|
85605
85671
|
Tabs.defaultProps = getDefaultPropsFromGlobalConfig(Tabs.__SemiComponentName__, {
|