@douyinfe/semi-ui 2.57.1-alpha.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.
Files changed (93) hide show
  1. package/dist/css/semi.css +85 -9
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +82 -21
  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/datePicker/monthsGrid.d.ts +1 -1
  11. package/lib/cjs/form/baseForm.d.ts +2 -2
  12. package/lib/cjs/form/field.d.ts +2 -2
  13. package/lib/cjs/locale/interface.d.ts +3 -0
  14. package/lib/cjs/locale/source/ar.js +3 -0
  15. package/lib/cjs/locale/source/de.js +3 -0
  16. package/lib/cjs/locale/source/en_GB.js +3 -0
  17. package/lib/cjs/locale/source/en_US.js +3 -0
  18. package/lib/cjs/locale/source/es.js +3 -0
  19. package/lib/cjs/locale/source/fr.js +3 -0
  20. package/lib/cjs/locale/source/id_ID.js +3 -0
  21. package/lib/cjs/locale/source/it.js +3 -0
  22. package/lib/cjs/locale/source/ja_JP.js +3 -0
  23. package/lib/cjs/locale/source/ko_KR.js +3 -0
  24. package/lib/cjs/locale/source/ms_MY.js +3 -0
  25. package/lib/cjs/locale/source/nl_NL.js +3 -0
  26. package/lib/cjs/locale/source/pl_PL.js +3 -0
  27. package/lib/cjs/locale/source/pt_BR.js +3 -0
  28. package/lib/cjs/locale/source/ro.js +3 -0
  29. package/lib/cjs/locale/source/ru_RU.js +3 -0
  30. package/lib/cjs/locale/source/sv_SE.js +3 -0
  31. package/lib/cjs/locale/source/th_TH.js +3 -0
  32. package/lib/cjs/locale/source/tr_TR.js +3 -0
  33. package/lib/cjs/locale/source/vi_VN.js +3 -0
  34. package/lib/cjs/locale/source/zh_CN.js +3 -0
  35. package/lib/cjs/locale/source/zh_TW.js +3 -0
  36. package/lib/cjs/modal/confirm.d.ts +9 -9
  37. package/lib/cjs/navigation/Item.js +1 -1
  38. package/lib/cjs/slider/index.js +9 -6
  39. package/lib/cjs/table/Body/BaseRow.d.ts +0 -2
  40. package/lib/cjs/table/Body/BaseRow.js +4 -9
  41. package/lib/cjs/table/ColGroup.d.ts +2 -2
  42. package/lib/cjs/table/interface.d.ts +16 -15
  43. package/lib/cjs/tabs/TabBar.d.ts +4 -0
  44. package/lib/cjs/tabs/TabBar.js +55 -3
  45. package/lib/cjs/tabs/TabItem.js +3 -1
  46. package/lib/cjs/tabs/index.d.ts +1 -0
  47. package/lib/cjs/tabs/index.js +7 -4
  48. package/lib/cjs/tabs/interface.d.ts +7 -0
  49. package/lib/cjs/typography/title.d.ts +1 -1
  50. package/lib/es/_base/base.css +2 -2
  51. package/lib/es/button/Button.d.ts +1 -1
  52. package/lib/es/button/Button.js +1 -0
  53. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  54. package/lib/es/form/baseForm.d.ts +2 -2
  55. package/lib/es/form/field.d.ts +2 -2
  56. package/lib/es/locale/interface.d.ts +3 -0
  57. package/lib/es/locale/source/ar.js +3 -0
  58. package/lib/es/locale/source/de.js +3 -0
  59. package/lib/es/locale/source/en_GB.js +3 -0
  60. package/lib/es/locale/source/en_US.js +3 -0
  61. package/lib/es/locale/source/es.js +3 -0
  62. package/lib/es/locale/source/fr.js +3 -0
  63. package/lib/es/locale/source/id_ID.js +3 -0
  64. package/lib/es/locale/source/it.js +3 -0
  65. package/lib/es/locale/source/ja_JP.js +3 -0
  66. package/lib/es/locale/source/ko_KR.js +3 -0
  67. package/lib/es/locale/source/ms_MY.js +3 -0
  68. package/lib/es/locale/source/nl_NL.js +3 -0
  69. package/lib/es/locale/source/pl_PL.js +3 -0
  70. package/lib/es/locale/source/pt_BR.js +3 -0
  71. package/lib/es/locale/source/ro.js +3 -0
  72. package/lib/es/locale/source/ru_RU.js +3 -0
  73. package/lib/es/locale/source/sv_SE.js +3 -0
  74. package/lib/es/locale/source/th_TH.js +3 -0
  75. package/lib/es/locale/source/tr_TR.js +3 -0
  76. package/lib/es/locale/source/vi_VN.js +3 -0
  77. package/lib/es/locale/source/zh_CN.js +3 -0
  78. package/lib/es/locale/source/zh_TW.js +3 -0
  79. package/lib/es/modal/confirm.d.ts +9 -9
  80. package/lib/es/navigation/Item.js +1 -1
  81. package/lib/es/slider/index.js +9 -6
  82. package/lib/es/table/Body/BaseRow.d.ts +0 -2
  83. package/lib/es/table/Body/BaseRow.js +4 -7
  84. package/lib/es/table/ColGroup.d.ts +2 -2
  85. package/lib/es/table/interface.d.ts +16 -15
  86. package/lib/es/tabs/TabBar.d.ts +4 -0
  87. package/lib/es/tabs/TabBar.js +56 -4
  88. package/lib/es/tabs/TabItem.js +3 -1
  89. package/lib/es/tabs/index.d.ts +1 -0
  90. package/lib/es/tabs/index.js +7 -4
  91. package/lib/es/tabs/interface.d.ts +7 -0
  92. package/lib/es/typography/title.d.ts +1 -1
  93. 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,
@@ -66543,7 +66547,7 @@ class Item_NavItem extends BaseComponent {
66543
66547
  onMouseEnter: onMouseEnter,
66544
66548
  onMouseLeave: onMouseLeave,
66545
66549
  onKeyPress: this.handleKeyPress
66546
- }), itemChildren);
66550
+ }, this.getDataAttr(this.props)), itemChildren);
66547
66551
  }
66548
66552
  // Display Tooltip when disabled and SubNav
66549
66553
  if (isCollapsed && !isInSubNav && !isSubNav || isCollapsed && isSubNav && disabled) {
@@ -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 (
@@ -76826,7 +76830,9 @@ class Slider extends BaseComponent {
76826
76830
  let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (noop_default());
76827
76831
  this.setState(stateObj, callback);
76828
76832
  },
76829
- notifyChange: cbValue => this.props.onChange(cbValue),
76833
+ notifyChange: cbValue => {
76834
+ this.props.onChange(Array.isArray(cbValue) ? [...cbValue].sort() : cbValue);
76835
+ },
76830
76836
  setDragging: value => {
76831
76837
  this.dragging = value;
76832
76838
  },
@@ -76979,7 +76985,8 @@ class Slider extends BaseComponent {
76979
76985
  [`${slider_prefixCls}`]: !vertical,
76980
76986
  [slider_constants_cssClasses.VERTICAL]: vertical
76981
76987
  });
76982
- const ariaLabel = range ? `Range: ${this._getAriaValueText(currentValue[0], 0)} to ${this._getAriaValueText(currentValue[1], 1)}` : undefined;
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;
76983
76990
  const slider = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", Object.assign({
76984
76991
  className: wrapperClass,
76985
76992
  style: style,
@@ -81656,9 +81663,6 @@ class TableRow extends BaseComponent {
81656
81663
  }
81657
81664
  constructor(props) {
81658
81665
  super(props);
81659
- this._cacheNode = node => {
81660
- this.ref.current = node;
81661
- };
81662
81666
  // Pass true to render the tree-shaped expand button
81663
81667
  this.renderExpandIcon = record => {
81664
81668
  const {
@@ -81687,7 +81691,6 @@ class TableRow extends BaseComponent {
81687
81691
  customRowProps.onClick(e);
81688
81692
  }
81689
81693
  };
81690
- this.ref = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createRef)();
81691
81694
  this.foundation = new TableRowFoundation(this.adapter);
81692
81695
  }
81693
81696
  componentDidMount() {
@@ -81828,7 +81831,8 @@ class TableRow extends BaseComponent {
81828
81831
  expandableRow,
81829
81832
  level,
81830
81833
  expandedRow,
81831
- isSection
81834
+ isSection,
81835
+ rowKey
81832
81836
  } = this.props;
81833
81837
  const BodyRow = components.body.row;
81834
81838
  const _a = onRow(record, index) || {},
@@ -81867,7 +81871,7 @@ class TableRow extends BaseComponent {
81867
81871
  }, ariaProps, rowProps, {
81868
81872
  style: baseRowStyle,
81869
81873
  className: rowCls,
81870
- ref: this._cacheNode,
81874
+ "data-row-key": rowKey,
81871
81875
  onMouseEnter: this.handleMouseEnter,
81872
81876
  onMouseLeave: this.handleMouseLeave,
81873
81877
  onClick: this.handleClick
@@ -84892,7 +84896,9 @@ const TabItem = (props, ref) => {
84892
84896
  onClick: e => deleteTabItem(itemKey, e)
84893
84897
  }) : null;
84894
84898
  }, [type, closable, deleteTabItem, itemKey]);
84895
- 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), []);
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), []);
84896
84902
  const handleKeyDownInItem = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(event => {
84897
84903
  handleKeyDown && handleKeyDown(event, itemKey, closable);
84898
84904
  }, [handleKeyDown, itemKey, closable]);
@@ -84950,6 +84956,7 @@ var TabBar_rest = undefined && undefined.__rest || function (s, e) {
84950
84956
 
84951
84957
 
84952
84958
 
84959
+
84953
84960
  class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Component {
84954
84961
  constructor(props) {
84955
84962
  super(props);
@@ -85087,6 +85094,55 @@ class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_rea
85087
85094
  visibleItemRenderer: this.renderTabItem
85088
85095
  });
85089
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
+ };
85090
85146
  this._isActive = key => key === this.props.activeKey;
85091
85147
  this._getItemKey = key => `${key}-bar`;
85092
85148
  this.state = {
@@ -85136,9 +85192,10 @@ class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_rea
85136
85192
  className,
85137
85193
  list,
85138
85194
  tabPosition,
85195
+ more,
85139
85196
  collapsible
85140
85197
  } = _a,
85141
- restProps = TabBar_rest(_a, ["type", "style", "className", "list", "tabPosition", "collapsible"]);
85198
+ restProps = TabBar_rest(_a, ["type", "style", "className", "list", "tabPosition", "more", "collapsible"]);
85142
85199
  const classNames = classnames_default()(className, {
85143
85200
  [tabs_constants_cssClasses.TABS_BAR]: true,
85144
85201
  [tabs_constants_cssClasses.TABS_BAR_LINE]: type === 'line',
@@ -85148,7 +85205,7 @@ class TabBar extends (external_root_React_commonjs2_react_commonjs_react_amd_rea
85148
85205
  [`${tabs_constants_cssClasses.TABS_BAR}-collapse`]: collapsible
85149
85206
  });
85150
85207
  const extra = this.renderExtra();
85151
- const contents = collapsible ? this.renderCollapsedTab() : this.renderTabComponents(list);
85208
+ const contents = collapsible ? this.renderCollapsedTab() : more ? this.renderWithMoreTrigger() : this.renderTabComponents(list);
85152
85209
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", Object.assign({
85153
85210
  role: "tablist",
85154
85211
  "aria-orientation": tabPosition === "left" ? "vertical" : "horizontal",
@@ -85171,7 +85228,8 @@ TabBar.propTypes = {
85171
85228
  tabPosition: prop_types_default().oneOf(tabs_constants_strings.POSITION_MAP),
85172
85229
  type: prop_types_default().oneOf(tabs_constants_strings.TYPE_MAP),
85173
85230
  closable: (prop_types_default()).bool,
85174
- 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])
85175
85233
  };
85176
85234
  /* harmony default export */ const tabs_TabBar = (TabBar);
85177
85235
  ;// CONCATENATED MODULE: ./tabs/tabs-context.ts
@@ -85530,9 +85588,10 @@ class Tabs extends BaseComponent {
85530
85588
  tabBarStyle,
85531
85589
  tabPaneMotion,
85532
85590
  tabPosition,
85533
- type
85591
+ type,
85592
+ more
85534
85593
  } = _a,
85535
- 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"]);
85536
85595
  const {
85537
85596
  panes,
85538
85597
  activeKey
@@ -85557,7 +85616,8 @@ class Tabs extends BaseComponent {
85557
85616
  tabPosition,
85558
85617
  type,
85559
85618
  deleteTabItem: this.deleteTabItem,
85560
- handleKeyDown: this.foundation.handleKeyDown
85619
+ handleKeyDown: this.foundation.handleKeyDown,
85620
+ more
85561
85621
  };
85562
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));
85563
85623
  const content = keepDOM ? children : this.getActiveItem();
@@ -85604,7 +85664,8 @@ Tabs.propTypes = {
85604
85664
  tabPosition: prop_types_default().oneOf(tabs_constants_strings.POSITION_MAP),
85605
85665
  type: prop_types_default().oneOf(tabs_constants_strings.TYPE_MAP),
85606
85666
  onTabClose: (prop_types_default()).func,
85607
- 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])
85608
85669
  };
85609
85670
  Tabs.__SemiComponentName__ = "Tabs";
85610
85671
  Tabs.defaultProps = getDefaultPropsFromGlobalConfig(Tabs.__SemiComponentName__, {