@douyinfe/semi-ui 2.58.0-beta.0 → 2.59.0-alpha.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 (73) hide show
  1. package/dist/css/semi.css +105 -29
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +87 -18
  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 +2 -2
  8. package/lib/cjs/button/Button.d.ts +1 -1
  9. package/lib/cjs/button/Button.js +1 -0
  10. package/lib/cjs/locale/interface.d.ts +3 -0
  11. package/lib/cjs/locale/source/ar.js +3 -0
  12. package/lib/cjs/locale/source/de.js +3 -0
  13. package/lib/cjs/locale/source/en_GB.js +3 -0
  14. package/lib/cjs/locale/source/en_US.js +3 -0
  15. package/lib/cjs/locale/source/es.js +3 -0
  16. package/lib/cjs/locale/source/fr.js +3 -0
  17. package/lib/cjs/locale/source/id_ID.js +3 -0
  18. package/lib/cjs/locale/source/it.js +3 -0
  19. package/lib/cjs/locale/source/ja_JP.js +3 -0
  20. package/lib/cjs/locale/source/ko_KR.js +3 -0
  21. package/lib/cjs/locale/source/ms_MY.js +3 -0
  22. package/lib/cjs/locale/source/nl_NL.js +3 -0
  23. package/lib/cjs/locale/source/pl_PL.js +3 -0
  24. package/lib/cjs/locale/source/pt_BR.js +3 -0
  25. package/lib/cjs/locale/source/ro.js +3 -0
  26. package/lib/cjs/locale/source/ru_RU.js +3 -0
  27. package/lib/cjs/locale/source/sv_SE.js +3 -0
  28. package/lib/cjs/locale/source/th_TH.js +3 -0
  29. package/lib/cjs/locale/source/tr_TR.js +3 -0
  30. package/lib/cjs/locale/source/vi_VN.js +3 -0
  31. package/lib/cjs/locale/source/zh_CN.js +3 -0
  32. package/lib/cjs/locale/source/zh_TW.js +3 -0
  33. package/lib/cjs/slider/index.js +13 -8
  34. package/lib/cjs/tabs/TabBar.d.ts +4 -0
  35. package/lib/cjs/tabs/TabBar.js +55 -3
  36. package/lib/cjs/tabs/TabItem.js +3 -1
  37. package/lib/cjs/tabs/index.d.ts +1 -0
  38. package/lib/cjs/tabs/index.js +7 -4
  39. package/lib/cjs/tabs/interface.d.ts +7 -0
  40. package/lib/es/_base/base.css +2 -2
  41. package/lib/es/button/Button.d.ts +1 -1
  42. package/lib/es/button/Button.js +1 -0
  43. package/lib/es/locale/interface.d.ts +3 -0
  44. package/lib/es/locale/source/ar.js +3 -0
  45. package/lib/es/locale/source/de.js +3 -0
  46. package/lib/es/locale/source/en_GB.js +3 -0
  47. package/lib/es/locale/source/en_US.js +3 -0
  48. package/lib/es/locale/source/es.js +3 -0
  49. package/lib/es/locale/source/fr.js +3 -0
  50. package/lib/es/locale/source/id_ID.js +3 -0
  51. package/lib/es/locale/source/it.js +3 -0
  52. package/lib/es/locale/source/ja_JP.js +3 -0
  53. package/lib/es/locale/source/ko_KR.js +3 -0
  54. package/lib/es/locale/source/ms_MY.js +3 -0
  55. package/lib/es/locale/source/nl_NL.js +3 -0
  56. package/lib/es/locale/source/pl_PL.js +3 -0
  57. package/lib/es/locale/source/pt_BR.js +3 -0
  58. package/lib/es/locale/source/ro.js +3 -0
  59. package/lib/es/locale/source/ru_RU.js +3 -0
  60. package/lib/es/locale/source/sv_SE.js +3 -0
  61. package/lib/es/locale/source/th_TH.js +3 -0
  62. package/lib/es/locale/source/tr_TR.js +3 -0
  63. package/lib/es/locale/source/vi_VN.js +3 -0
  64. package/lib/es/locale/source/zh_CN.js +3 -0
  65. package/lib/es/locale/source/zh_TW.js +3 -0
  66. package/lib/es/slider/index.js +13 -8
  67. package/lib/es/tabs/TabBar.d.ts +4 -0
  68. package/lib/es/tabs/TabBar.js +56 -4
  69. package/lib/es/tabs/TabItem.js +3 -1
  70. package/lib/es/tabs/index.d.ts +1 -0
  71. package/lib/es/tabs/index.js +7 -4
  72. package/lib/es/tabs/interface.d.ts +7 -0
  73. package/package.json +8 -8
@@ -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,
@@ -69157,7 +69161,7 @@ class SelectFoundation extends foundation {
69157
69161
  this._setDropdownWidth();
69158
69162
  const isDefaultOpen = this.getProp('defaultOpen');
69159
69163
  const isOpen = this.getProp('open');
69160
- const originalOptions = this._collectOptions();
69164
+ const originalOptions = this._collectOptions(false);
69161
69165
  this._setDefaultSelection(originalOptions);
69162
69166
  if (isDefaultOpen || isOpen) {
69163
69167
  this.open(undefined, originalOptions);
@@ -69210,10 +69214,13 @@ class SelectFoundation extends foundation {
69210
69214
  }
69211
69215
  }
69212
69216
  _collectOptions() {
69217
+ let needReposition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
69213
69218
  const originalOptions = this._adapter.getOptionsFromChildren();
69214
69219
  this._adapter.updateOptions(originalOptions);
69215
69220
  // Reposition the drop-down layer
69216
- this._adapter.rePositionDropdown();
69221
+ if (needReposition) {
69222
+ this._adapter.rePositionDropdown();
69223
+ }
69217
69224
  return originalOptions;
69218
69225
  }
69219
69226
  _setDefaultSelection(originalOptions) {
@@ -76644,11 +76651,11 @@ class Slider extends BaseComponent {
76644
76651
  const minPercent = percentInfo.min;
76645
76652
  const maxPercent = percentInfo.max;
76646
76653
  let trackStyle = !vertical ? {
76647
- width: range ? `${(maxPercent - minPercent) * 100}%` : `${minPercent * 100}%`,
76648
- left: range ? `${minPercent * 100}%` : 0
76654
+ width: range ? `${Math.abs(maxPercent - minPercent) * 100}%` : `${minPercent * 100}%`,
76655
+ left: range ? `${Math.min(minPercent, maxPercent) * 100}%` : 0
76649
76656
  } : {
76650
- height: range ? `${(maxPercent - minPercent) * 100}%` : `${minPercent * 100}%`,
76651
- top: range ? `${minPercent * 100}%` : 0
76657
+ height: range ? `${Math.abs(maxPercent - minPercent) * 100}%` : `${minPercent * 100}%`,
76658
+ top: range ? `${Math.min(minPercent, maxPercent) * 100}%` : 0
76652
76659
  };
76653
76660
  trackStyle = included ? trackStyle : {};
76654
76661
  return (
@@ -76763,11 +76770,13 @@ class Slider extends BaseComponent {
76763
76770
  var _this = this;
76764
76771
  return Object.assign(Object.assign({}, super.adapter), {
76765
76772
  getSliderLengths: () => {
76773
+ var _a;
76766
76774
  if (this.sliderEl && this.sliderEl.current) {
76767
76775
  const rect = this.sliderEl.current.getBoundingClientRect();
76776
+ const offsetParentRect = (_a = this.sliderEl.current.offsetParent) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
76768
76777
  const offset = {
76769
- x: this.sliderEl.current.offsetLeft,
76770
- y: this.sliderEl.current.offsetTop
76778
+ x: offsetParentRect ? rect.left - offsetParentRect.left : this.sliderEl.current.offsetLeft,
76779
+ y: offsetParentRect ? rect.top - offsetParentRect.top : this.sliderEl.current.offsetTop
76771
76780
  };
76772
76781
  return {
76773
76782
  sliderX: offset.x,
@@ -76824,7 +76833,9 @@ class Slider extends BaseComponent {
76824
76833
  let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (noop_default());
76825
76834
  this.setState(stateObj, callback);
76826
76835
  },
76827
- notifyChange: cbValue => this.props.onChange(cbValue),
76836
+ notifyChange: cbValue => {
76837
+ this.props.onChange(Array.isArray(cbValue) ? [...cbValue].sort() : cbValue);
76838
+ },
76828
76839
  setDragging: value => {
76829
76840
  this.dragging = value;
76830
76841
  },
@@ -76977,7 +76988,8 @@ class Slider extends BaseComponent {
76977
76988
  [`${slider_prefixCls}`]: !vertical,
76978
76989
  [slider_constants_cssClasses.VERTICAL]: vertical
76979
76990
  });
76980
- const ariaLabel = range ? `Range: ${this._getAriaValueText(currentValue[0], 0)} to ${this._getAriaValueText(currentValue[1], 1)}` : undefined;
76991
+ const fixedCurrentValue = Array.isArray(currentValue) ? [...currentValue].sort() : currentValue;
76992
+ const ariaLabel = range ? `Range: ${this._getAriaValueText(fixedCurrentValue[0], 0)} to ${this._getAriaValueText(fixedCurrentValue[1], 1)}` : undefined;
76981
76993
  const slider = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", Object.assign({
76982
76994
  className: wrapperClass,
76983
76995
  style: style,
@@ -84887,7 +84899,9 @@ const TabItem = (props, ref) => {
84887
84899
  onClick: e => deleteTabItem(itemKey, e)
84888
84900
  }) : null;
84889
84901
  }, [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", null, icon), []);
84902
+ 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", {
84903
+ className: `${tabs_constants_cssClasses.TABS_BAR}-icon`
84904
+ }, icon), []);
84891
84905
  const handleKeyDownInItem = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(event => {
84892
84906
  handleKeyDown && handleKeyDown(event, itemKey, closable);
84893
84907
  }, [handleKeyDown, itemKey, closable]);
@@ -84945,6 +84959,7 @@ var TabBar_rest = undefined && undefined.__rest || function (s, e) {
84945
84959
 
84946
84960
 
84947
84961
 
84962
+
84948
84963
  class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Component {
84949
84964
  constructor(props) {
84950
84965
  super(props);
@@ -85082,6 +85097,55 @@ class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_rea
85082
85097
  visibleItemRenderer: this.renderTabItem
85083
85098
  });
85084
85099
  };
85100
+ this.renderWithMoreTrigger = () => {
85101
+ const {
85102
+ list,
85103
+ more
85104
+ } = this.props;
85105
+ let tabElements = [];
85106
+ let moreTrigger = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
85107
+ className: classnames_default()({
85108
+ [`${tabs_constants_cssClasses.TABS_BAR}-more-trigger`]: true,
85109
+ [`${tabs_constants_cssClasses.TABS_BAR}-more-trigger-${this.props.type}`]: true
85110
+ })
85111
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(LocaleConsumer, {
85112
+ componentName: "Tabs"
85113
+ }, (locale, localeCode) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
85114
+ className: `${tabs_constants_cssClasses.TABS_BAR}-more-trigger-content`
85115
+ }, /*#__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, {
85116
+ className: `${tabs_constants_cssClasses.TABS_BAR}-more-trigger-content-icon`
85117
+ }))));
85118
+ let keepCount;
85119
+ if (typeof more === "number") {
85120
+ keepCount = list.length - Math.min(more, list.length);
85121
+ tabElements = list.slice(0, keepCount).map(panel => this.renderTabItem(panel));
85122
+ } else if (typeof more === 'object') {
85123
+ keepCount = list.length - Math.min(more.count, list.length);
85124
+ tabElements = list.slice(0, keepCount).map(panel => this.renderTabItem(panel));
85125
+ if (more.render) {
85126
+ moreTrigger = more.render();
85127
+ }
85128
+ } else if (more !== undefined) {
85129
+ throw new Error("[Semi Tabs]: invalid tab props format: more");
85130
+ }
85131
+ 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));
85132
+ };
85133
+ this.renderMoreDropdown = (panels, dropDownProps, trigger) => {
85134
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(dropdown_0, Object.assign({
85135
+ trigger: 'hover',
85136
+ showTick: true,
85137
+ position: 'bottomLeft',
85138
+ className: `${tabs_constants_cssClasses.TABS_BAR}-more-dropdown-${this.props.type}`,
85139
+ clickToHide: true,
85140
+ menu: panels.map(panel => ({
85141
+ node: 'item',
85142
+ name: panel.tab,
85143
+ icon: panel.icon,
85144
+ onClick: e => this.props.onTabClick(panel.itemKey, e),
85145
+ active: this.props.activeKey === panel.itemKey
85146
+ }))
85147
+ }, dropDownProps), trigger);
85148
+ };
85085
85149
  this._isActive = key => key === this.props.activeKey;
85086
85150
  this._getItemKey = key => `${key}-bar`;
85087
85151
  this.state = {
@@ -85131,9 +85195,10 @@ class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_rea
85131
85195
  className,
85132
85196
  list,
85133
85197
  tabPosition,
85198
+ more,
85134
85199
  collapsible
85135
85200
  } = _a,
85136
- restProps = TabBar_rest(_a, ["type", "style", "className", "list", "tabPosition", "collapsible"]);
85201
+ restProps = TabBar_rest(_a, ["type", "style", "className", "list", "tabPosition", "more", "collapsible"]);
85137
85202
  const classNames = classnames_default()(className, {
85138
85203
  [tabs_constants_cssClasses.TABS_BAR]: true,
85139
85204
  [tabs_constants_cssClasses.TABS_BAR_LINE]: type === 'line',
@@ -85143,7 +85208,7 @@ class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_rea
85143
85208
  [`${tabs_constants_cssClasses.TABS_BAR}-collapse`]: collapsible
85144
85209
  });
85145
85210
  const extra = this.renderExtra();
85146
- const contents = collapsible ? this.renderCollapsedTab() : this.renderTabComponents(list);
85211
+ const contents = collapsible ? this.renderCollapsedTab() : more ? this.renderWithMoreTrigger() : this.renderTabComponents(list);
85147
85212
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", Object.assign({
85148
85213
  role: "tablist",
85149
85214
  "aria-orientation": tabPosition === "left" ? "vertical" : "horizontal",
@@ -85166,7 +85231,8 @@ TabBar.propTypes = {
85166
85231
  tabPosition: prop_types_default().oneOf(tabs_constants_strings.POSITION_MAP),
85167
85232
  type: prop_types_default().oneOf(tabs_constants_strings.TYPE_MAP),
85168
85233
  closable: (prop_types_default()).bool,
85169
- deleteTabItem: (prop_types_default()).func
85234
+ deleteTabItem: (prop_types_default()).func,
85235
+ more: prop_types_default().oneOfType([(prop_types_default()).number, (prop_types_default()).object])
85170
85236
  };
85171
85237
  /* harmony default export */ const tabs_TabBar = (TabBar);
85172
85238
  ;// CONCATENATED MODULE: ./tabs/tabs-context.ts
@@ -85525,9 +85591,10 @@ class Tabs extends BaseComponent {
85525
85591
  tabBarStyle,
85526
85592
  tabPaneMotion,
85527
85593
  tabPosition,
85528
- type
85594
+ type,
85595
+ more
85529
85596
  } = _a,
85530
- restProps = tabs_rest(_a, ["children", "className", "collapsible", "contentStyle", "keepDOM", "lazyRender", "renderTabBar", "size", "style", "tabBarClassName", "tabBarExtraContent", "tabBarStyle", "tabPaneMotion", "tabPosition", "type"]);
85597
+ restProps = tabs_rest(_a, ["children", "className", "collapsible", "contentStyle", "keepDOM", "lazyRender", "renderTabBar", "size", "style", "tabBarClassName", "tabBarExtraContent", "tabBarStyle", "tabPaneMotion", "tabPosition", "type", "more"]);
85531
85598
  const {
85532
85599
  panes,
85533
85600
  activeKey
@@ -85552,7 +85619,8 @@ class Tabs extends BaseComponent {
85552
85619
  tabPosition,
85553
85620
  type,
85554
85621
  deleteTabItem: this.deleteTabItem,
85555
- handleKeyDown: this.foundation.handleKeyDown
85622
+ handleKeyDown: this.foundation.handleKeyDown,
85623
+ more
85556
85624
  };
85557
85625
  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
85626
  const content = keepDOM ? children : this.getActiveItem();
@@ -85599,7 +85667,8 @@ Tabs.propTypes = {
85599
85667
  tabPosition: prop_types_default().oneOf(tabs_constants_strings.POSITION_MAP),
85600
85668
  type: prop_types_default().oneOf(tabs_constants_strings.TYPE_MAP),
85601
85669
  onTabClose: (prop_types_default()).func,
85602
- preventScroll: (prop_types_default()).bool
85670
+ preventScroll: (prop_types_default()).bool,
85671
+ more: prop_types_default().oneOfType([(prop_types_default()).number, (prop_types_default()).object])
85603
85672
  };
85604
85673
  Tabs.__SemiComponentName__ = "Tabs";
85605
85674
  Tabs.defaultProps = getDefaultPropsFromGlobalConfig(Tabs.__SemiComponentName__, {