@douyinfe/semi-ui 2.22.2 → 2.23.0-beta.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 (53) hide show
  1. package/dist/css/semi.css +8 -1
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +69 -35
  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/form/baseForm.d.ts +4 -4
  8. package/lib/cjs/form/errorMessage.d.ts +2 -1
  9. package/lib/cjs/form/hooks/useFormState.d.ts +2 -1
  10. package/lib/cjs/form/interface.d.ts +15 -15
  11. package/lib/cjs/image/image.js +12 -0
  12. package/lib/cjs/image/interface.d.ts +1 -1
  13. package/lib/cjs/image/preview.d.ts +1 -1
  14. package/lib/cjs/image/preview.js +2 -2
  15. package/lib/cjs/image/previewImage.d.ts +1 -1
  16. package/lib/cjs/image/previewImage.js +1 -1
  17. package/lib/cjs/image/previewInner.d.ts +1 -1
  18. package/lib/cjs/image/previewInner.js +13 -5
  19. package/lib/cjs/locale/source/tr_TR.js +2 -2
  20. package/lib/cjs/navigation/Item.d.ts +3 -0
  21. package/lib/cjs/navigation/Item.js +9 -5
  22. package/lib/cjs/table/Body/index.js +2 -2
  23. package/lib/cjs/table/Table.js +3 -2
  24. package/lib/cjs/tabs/TabPane.js +4 -3
  25. package/lib/cjs/tabs/interface.d.ts +1 -0
  26. package/lib/cjs/tagInput/index.d.ts +1 -1
  27. package/lib/cjs/tagInput/index.js +6 -4
  28. package/lib/cjs/transfer/index.d.ts +1 -0
  29. package/lib/cjs/transfer/index.js +7 -1
  30. package/lib/es/form/baseForm.d.ts +4 -4
  31. package/lib/es/form/errorMessage.d.ts +2 -1
  32. package/lib/es/form/hooks/useFormState.d.ts +2 -1
  33. package/lib/es/form/interface.d.ts +15 -15
  34. package/lib/es/image/image.js +11 -0
  35. package/lib/es/image/interface.d.ts +1 -1
  36. package/lib/es/image/preview.d.ts +1 -1
  37. package/lib/es/image/preview.js +2 -2
  38. package/lib/es/image/previewImage.d.ts +1 -1
  39. package/lib/es/image/previewImage.js +1 -1
  40. package/lib/es/image/previewInner.d.ts +1 -1
  41. package/lib/es/image/previewInner.js +13 -5
  42. package/lib/es/locale/source/tr_TR.js +2 -2
  43. package/lib/es/navigation/Item.d.ts +3 -0
  44. package/lib/es/navigation/Item.js +9 -5
  45. package/lib/es/table/Body/index.js +3 -3
  46. package/lib/es/table/Table.js +3 -2
  47. package/lib/es/tabs/TabPane.js +4 -3
  48. package/lib/es/tabs/interface.d.ts +1 -0
  49. package/lib/es/tagInput/index.d.ts +1 -1
  50. package/lib/es/tagInput/index.js +6 -4
  51. package/lib/es/transfer/index.d.ts +1 -0
  52. package/lib/es/transfer/index.js +7 -1
  53. package/package.json +7 -7
@@ -43320,20 +43320,22 @@ class tagInput_TagInput extends baseComponent_BaseComponent {
43320
43320
  return tagsArray.map((value, index) => {
43321
43321
  const elementKey = showIconHandler ? value : "".concat(index).concat(value);
43322
43322
 
43323
+ const onClose = () => {
43324
+ !disabled && this.handleTagClose(index);
43325
+ };
43326
+
43323
43327
  if (isFunction_default()(renderTagItem)) {
43324
43328
  return showIconHandler ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
43325
43329
  className: itemWrapperCls,
43326
43330
  key: elementKey
43327
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(DragHandle, null), renderTagItem(value, index)) : renderTagItem(value, index);
43331
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(DragHandle, null), renderTagItem(value, index, onClose)) : renderTagItem(value, index, onClose);
43328
43332
  } else {
43329
43333
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(tag_Tag, {
43330
43334
  className: tagCls,
43331
43335
  color: "white",
43332
43336
  size: size === 'small' ? 'small' : 'large',
43333
43337
  type: "light",
43334
- onClose: () => {
43335
- !disabled && this.handleTagClose(index);
43336
- },
43338
+ onClose: onClose,
43337
43339
  closable: !disabled,
43338
43340
  key: elementKey,
43339
43341
  visible: true,
@@ -64606,7 +64608,8 @@ class Item_NavItem extends baseComponent_BaseComponent {
64606
64608
  link,
64607
64609
  linkOptions,
64608
64610
  disabled,
64609
- level = 0
64611
+ level = 0,
64612
+ tabIndex
64610
64613
  } = this.props;
64611
64614
  const {
64612
64615
  mode,
@@ -64669,7 +64672,8 @@ class Item_NavItem extends baseComponent_BaseComponent {
64669
64672
  ["".concat(Item_clsPrefix, "-sub")]: isSubNav,
64670
64673
  ["".concat(Item_clsPrefix, "-selected")]: selected && !isSubNav,
64671
64674
  ["".concat(Item_clsPrefix, "-collapsed")]: isCollapsed,
64672
- ["".concat(Item_clsPrefix, "-disabled")]: disabled
64675
+ ["".concat(Item_clsPrefix, "-disabled")]: disabled,
64676
+ ["".concat(Item_clsPrefix, "-has-link")]: typeof link === 'string'
64673
64677
  });
64674
64678
  const ariaProps = {
64675
64679
  'aria-disabled': disabled
@@ -64686,7 +64690,7 @@ class Item_NavItem extends baseComponent_BaseComponent {
64686
64690
  external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("li", Object.assign({
64687
64691
  // if role = menuitem, the narration will read all expanded li
64688
64692
  role: isSubNav ? null : "menuitem",
64689
- tabIndex: isSubNav ? -1 : 0
64693
+ tabIndex: isSubNav ? -1 : tabIndex
64690
64694
  }, ariaProps, {
64691
64695
  style: style,
64692
64696
  ref: this.setItemRef,
@@ -64725,7 +64729,8 @@ Item_NavItem.propTypes = {
64725
64729
  isSubNav: prop_types_default.a.bool,
64726
64730
  link: prop_types_default.a.string,
64727
64731
  linkOptions: prop_types_default.a.object,
64728
- disabled: prop_types_default.a.bool
64732
+ disabled: prop_types_default.a.bool,
64733
+ tabIndex: prop_types_default.a.number
64729
64734
  };
64730
64735
  Item_NavItem.defaultProps = {
64731
64736
  isSubNav: false,
@@ -64735,7 +64740,8 @@ Item_NavItem.defaultProps = {
64735
64740
  onClick: noop_default.a,
64736
64741
  onMouseEnter: noop_default.a,
64737
64742
  onMouseLeave: noop_default.a,
64738
- disabled: false
64743
+ disabled: false,
64744
+ tabIndex: 0
64739
64745
  };
64740
64746
  // CONCATENATED MODULE: ./navigation/SubNav.tsx
64741
64747
 
@@ -79057,7 +79063,8 @@ const DEFAULT_CELL_MIDDLE_PADDING_TOP = 12;
79057
79063
  const DEFAULT_CELL_MIDDLE_PADDING_BOTTOM = 12;
79058
79064
  const DEFAULT_CELL_SMALL_PADDING_TOP = 8;
79059
79065
  const DEFAULT_CELL_SMALL_PADDING_BOTTOM = 8;
79060
- const DEFAULT_CELL_LINE_HEIGHT = 20; // normal size
79066
+ const DEFAULT_CELL_LINE_HEIGHT = 20;
79067
+ const DEFAULT_EMPTYSLOT_HEIGHT = 52; // normal size
79061
79068
 
79062
79069
  const DEFAULT_VIRTUALIZED_ROW_HEIGHT = DEFAULT_CELL_LINE_HEIGHT + DEFAULT_CELL_BORDER_WITH_BOTTOM + DEFAULT_CELL_BORDER_WITH_TOP + DEFAULT_CELL_PADDING_TOP + DEFAULT_CELL_PADDING_BOTTOM;
79063
79070
  const DEFAULT_VIRTUALIZED_ROW_MIN_HEIGHT = DEFAULT_CELL_PADDING_TOP + DEFAULT_CELL_PADDING_BOTTOM + DEFAULT_CELL_BORDER_WITH_BOTTOM; // middle size
@@ -79093,7 +79100,8 @@ const table_constants_numbers = {
79093
79100
  DEFAULT_VIRTUALIZED_ROW_MIDDLE_MIN_HEIGHT,
79094
79101
  DEFAULT_VIRTUALIZED_SECTION_ROW_SMALL_HEIGHT: DEFAULT_VIRTUALIZED_ROW_SMALL_HEIGHT,
79095
79102
  DEFAULT_VIRTUALIZED_ROW_SMALL_HEIGHT,
79096
- DEFAULT_VIRTUALIZED_ROW_SMALL_MIN_HEIGHT
79103
+ DEFAULT_VIRTUALIZED_ROW_SMALL_MIN_HEIGHT,
79104
+ DEFAULT_EMPTYSLOT_HEIGHT
79097
79105
  };
79098
79106
 
79099
79107
  // CONCATENATED MODULE: ../semi-foundation/utils/Logger.ts
@@ -83792,7 +83800,7 @@ class Body_Body extends baseComponent_BaseComponent {
83792
83800
  width: tableWidth
83793
83801
  },
83794
83802
  className: tableCls
83795
- }, size_default()(dataSource) === 0 ? emptySlot : children));
83803
+ }, children), size_default()(dataSource) === 0 && emptySlot);
83796
83804
  });
83797
83805
 
83798
83806
  this.onItemsRendered = props => {
@@ -83832,7 +83840,7 @@ class Body_Body extends baseComponent_BaseComponent {
83832
83840
 
83833
83841
  const listStyle = {
83834
83842
  width: '100%',
83835
- height: (virtualizedData === null || virtualizedData === void 0 ? void 0 : virtualizedData.length) ? y : 0,
83843
+ height: (virtualizedData === null || virtualizedData === void 0 ? void 0 : virtualizedData.length) ? y : table_constants_numbers.DEFAULT_EMPTYSLOT_HEIGHT,
83836
83844
  overflowX: 'auto',
83837
83845
  overflowY: 'auto'
83838
83846
  };
@@ -85030,8 +85038,9 @@ class Table_Table extends baseComponent_BaseComponent {
85030
85038
  useFixedHeader,
85031
85039
  headerRef: this._cacheHeaderRef,
85032
85040
  bodyRef: this.bodyWrapRef,
85033
- includeHeader: !useFixedHeader
85034
- })), emptySlot, this.renderFooter(props)];
85041
+ includeHeader: !useFixedHeader,
85042
+ emptySlot
85043
+ })), this.renderFooter(props)];
85035
85044
  return table;
85036
85045
  };
85037
85046
 
@@ -86886,9 +86895,10 @@ class TabPane_TabPane extends external_root_React_commonjs2_react_commonjs_react
86886
86895
  className,
86887
86896
  style,
86888
86897
  children,
86889
- itemKey
86898
+ itemKey,
86899
+ tabIndex
86890
86900
  } = _a,
86891
- restProps = TabPane_rest(_a, ["className", "style", "children", "itemKey"]);
86901
+ restProps = TabPane_rest(_a, ["className", "style", "children", "itemKey", "tabIndex"]);
86892
86902
 
86893
86903
  const active = this.context.activeKey === itemKey;
86894
86904
  const classNames = classnames_default()(className, {
@@ -86926,7 +86936,7 @@ class TabPane_TabPane extends external_root_React_commonjs2_react_commonjs_react
86926
86936
  className: classNames,
86927
86937
  style: style,
86928
86938
  "aria-hidden": active ? 'false' : 'true',
86929
- tabIndex: 0
86939
+ tabIndex: tabIndex ? tabIndex : 0
86930
86940
  }, getDataAttr(restProps), {
86931
86941
  "x-semi-prop": "children"
86932
86942
  }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(_cssAnimation, {
@@ -96667,7 +96677,7 @@ class foundation_TransferFoundation extends foundation {
96667
96677
  return path.map(p => p.label).join(' > ');
96668
96678
  }
96669
96679
 
96670
- handleInputChange(inputVal) {
96680
+ handleInputChange(inputVal, notify) {
96671
96681
  const {
96672
96682
  data
96673
96683
  } = this.getStates();
@@ -96681,7 +96691,7 @@ class foundation_TransferFoundation extends foundation {
96681
96691
 
96682
96692
  this._adapter.searchTree(inputVal);
96683
96693
 
96684
- this._adapter.notifySearch(inputVal);
96694
+ notify && this._adapter.notifySearch(inputVal);
96685
96695
 
96686
96696
  this._adapter.updateInput(inputVal);
96687
96697
 
@@ -96693,8 +96703,7 @@ class foundation_TransferFoundation extends foundation {
96693
96703
  const filterFunc = typeof filter === 'function' ? item => filter(inputVal, item) : item => typeof item.label === 'string' && item.label.includes(inputVal);
96694
96704
  const searchData = data.filter(filterFunc);
96695
96705
  const searchResult = new Set(searchData.map(item => item.key));
96696
-
96697
- this._adapter.notifySearch(inputVal);
96706
+ notify && this._adapter.notifySearch(inputVal);
96698
96707
 
96699
96708
  this._adapter.updateInput(inputVal);
96700
96709
 
@@ -97039,7 +97048,13 @@ class transfer_Transfer extends baseComponent_BaseComponent {
97039
97048
  }
97040
97049
 
97041
97050
  onInputChange(value) {
97042
- this.foundation.handleInputChange(value);
97051
+ this.foundation.handleInputChange(value, true);
97052
+ }
97053
+
97054
+ search(value) {
97055
+ // The search method is used to provide the user with a manually triggered search
97056
+ // Since the method is manually called by the user, setting the second parameter to false does not trigger the onSearch callback to notify the user
97057
+ this.foundation.handleInputChange(value, false);
97043
97058
  }
97044
97059
 
97045
97060
  onSelectOrRemove(item) {
@@ -100351,9 +100366,9 @@ class previewFooterFoundation_PreviewFooterFoundation extends foundation {
100351
100366
  } = this.getProps();
100352
100367
 
100353
100368
  if (value > zoom) {
100354
- onZoomIn(value / 100);
100369
+ onZoomIn(Number((value / 100).toFixed(2)));
100355
100370
  } else {
100356
- onZoomOut(value / 100);
100371
+ onZoomOut(Number((value / 100).toFixed(2)));
100357
100372
  }
100358
100373
 
100359
100374
  this._adapter.setStartMouseOffset(value);
@@ -101280,7 +101295,7 @@ previewImage_PreviewImage.propTypes = {
101280
101295
  zoomStep: prop_types_default.a.number,
101281
101296
  zoom: prop_types_default.a.number,
101282
101297
  ratio: prop_types_default.a.string,
101283
- disableDownload: prop_types_default.a.number,
101298
+ disableDownload: prop_types_default.a.bool,
101284
101299
  clickZoom: prop_types_default.a.number,
101285
101300
  setRatio: prop_types_default.a.func,
101286
101301
  onZoom: prop_types_default.a.func,
@@ -101510,7 +101525,7 @@ class previewInnerFoundation_PreviewInnerFoundation extends foundation {
101510
101525
  });
101511
101526
  }
101512
101527
 
101513
- this._adapter.notifyChange(newIndex);
101528
+ this._adapter.notifyChange(newIndex, direction);
101514
101529
 
101515
101530
  this.setState({
101516
101531
  direction,
@@ -101822,11 +101837,19 @@ class previewInner_PreviewInner extends baseComponent_BaseComponent {
101822
101837
  get adapter() {
101823
101838
  return Object.assign(Object.assign({}, super.adapter), {
101824
101839
  getIsInGroup: () => this.isInGroup(),
101825
- notifyChange: index => {
101840
+ notifyChange: (index, direction) => {
101826
101841
  const {
101827
- onChange
101842
+ onChange,
101843
+ onPrev,
101844
+ onNext
101828
101845
  } = this.props;
101829
101846
  isFunction_default()(onChange) && onChange(index);
101847
+
101848
+ if (direction === "prev") {
101849
+ onPrev && onPrev(index);
101850
+ } else {
101851
+ onNext && onNext(index);
101852
+ }
101830
101853
  },
101831
101854
  notifyZoom: (zoom, increase) => {
101832
101855
  const {
@@ -101860,9 +101883,9 @@ class previewInner_PreviewInner extends baseComponent_BaseComponent {
101860
101883
  },
101861
101884
  notifyRotateChange: angle => {
101862
101885
  const {
101863
- onRotateChange
101886
+ onRotateLeft
101864
101887
  } = this.props;
101865
- isFunction_default()(onRotateChange) && onRotateChange(angle);
101888
+ isFunction_default()(onRotateLeft) && onRotateLeft(angle);
101866
101889
  },
101867
101890
  notifyDownload: (src, index) => {
101868
101891
  const {
@@ -102120,7 +102143,7 @@ previewInner_PreviewInner.propTypes = {
102120
102143
  onNext: prop_types_default.a.func,
102121
102144
  onDownload: prop_types_default.a.func,
102122
102145
  onRatioChange: prop_types_default.a.func,
102123
- onRotateChange: prop_types_default.a.func
102146
+ onRotateLeft: prop_types_default.a.func
102124
102147
  };
102125
102148
  previewInner_PreviewInner.defaultProps = {
102126
102149
  showTooltip: false,
@@ -102197,7 +102220,7 @@ class imageFoundation_ImageFoundation extends foundation {
102197
102220
  } = preview;
102198
102221
  onVisibleChange && onVisibleChange(newVisible);
102199
102222
 
102200
- if (!("visible" in this.getProps())) {
102223
+ if (!("visible" in preview)) {
102201
102224
  this.setState({
102202
102225
  previewVisible: newVisible
102203
102226
  });
@@ -102217,6 +102240,7 @@ var image_image = __webpack_require__("txvO");
102217
102240
  // CONCATENATED MODULE: ./image/image.tsx
102218
102241
 
102219
102242
 
102243
+
102220
102244
  /* eslint-disable jsx-a11y/click-events-have-key-events */
102221
102245
 
102222
102246
  /* eslint-disable jsx-a11y/no-static-element-interactions */
@@ -102348,6 +102372,16 @@ class image_Image extends baseComponent_BaseComponent {
102348
102372
  willUpdateStates.loadStatus = "loading";
102349
102373
  }
102350
102374
 
102375
+ if (isObject_default()(props.preview)) {
102376
+ const {
102377
+ visible
102378
+ } = props.preview;
102379
+
102380
+ if (isBoolean_default()(visible)) {
102381
+ willUpdateStates.previewVisible = visible;
102382
+ }
102383
+ }
102384
+
102351
102385
  return willUpdateStates;
102352
102386
  }
102353
102387
 
@@ -102708,8 +102742,8 @@ preview_Preview.propTypes = {
102708
102742
  onPrev: prop_types_default.a.func,
102709
102743
  onNext: prop_types_default.a.func,
102710
102744
  onDownload: prop_types_default.a.func,
102711
- onRatioChange: prop_types_default.a.func,
102712
- onRotateChange: prop_types_default.a.func
102745
+ onRotateLeft: prop_types_default.a.func,
102746
+ onRatioChange: prop_types_default.a.func
102713
102747
  };
102714
102748
  preview_Preview.defaultProps = {
102715
102749
  src: [],