@douyinfe/semi-ui 2.22.3 → 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 (49) 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 +65 -32
  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/tagInput/index.d.ts +1 -1
  25. package/lib/cjs/tagInput/index.js +6 -4
  26. package/lib/cjs/transfer/index.d.ts +1 -0
  27. package/lib/cjs/transfer/index.js +7 -1
  28. package/lib/es/form/baseForm.d.ts +4 -4
  29. package/lib/es/form/errorMessage.d.ts +2 -1
  30. package/lib/es/form/hooks/useFormState.d.ts +2 -1
  31. package/lib/es/form/interface.d.ts +15 -15
  32. package/lib/es/image/image.js +11 -0
  33. package/lib/es/image/interface.d.ts +1 -1
  34. package/lib/es/image/preview.d.ts +1 -1
  35. package/lib/es/image/preview.js +2 -2
  36. package/lib/es/image/previewImage.d.ts +1 -1
  37. package/lib/es/image/previewImage.js +1 -1
  38. package/lib/es/image/previewInner.d.ts +1 -1
  39. package/lib/es/image/previewInner.js +13 -5
  40. package/lib/es/locale/source/tr_TR.js +2 -2
  41. package/lib/es/navigation/Item.d.ts +3 -0
  42. package/lib/es/navigation/Item.js +9 -5
  43. package/lib/es/table/Body/index.js +3 -3
  44. package/lib/es/table/Table.js +3 -2
  45. package/lib/es/tagInput/index.d.ts +1 -1
  46. package/lib/es/tagInput/index.js +6 -4
  47. package/lib/es/transfer/index.d.ts +1 -0
  48. package/lib/es/transfer/index.js +7 -1
  49. 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
 
@@ -96668,7 +96677,7 @@ class foundation_TransferFoundation extends foundation {
96668
96677
  return path.map(p => p.label).join(' > ');
96669
96678
  }
96670
96679
 
96671
- handleInputChange(inputVal) {
96680
+ handleInputChange(inputVal, notify) {
96672
96681
  const {
96673
96682
  data
96674
96683
  } = this.getStates();
@@ -96682,7 +96691,7 @@ class foundation_TransferFoundation extends foundation {
96682
96691
 
96683
96692
  this._adapter.searchTree(inputVal);
96684
96693
 
96685
- this._adapter.notifySearch(inputVal);
96694
+ notify && this._adapter.notifySearch(inputVal);
96686
96695
 
96687
96696
  this._adapter.updateInput(inputVal);
96688
96697
 
@@ -96694,8 +96703,7 @@ class foundation_TransferFoundation extends foundation {
96694
96703
  const filterFunc = typeof filter === 'function' ? item => filter(inputVal, item) : item => typeof item.label === 'string' && item.label.includes(inputVal);
96695
96704
  const searchData = data.filter(filterFunc);
96696
96705
  const searchResult = new Set(searchData.map(item => item.key));
96697
-
96698
- this._adapter.notifySearch(inputVal);
96706
+ notify && this._adapter.notifySearch(inputVal);
96699
96707
 
96700
96708
  this._adapter.updateInput(inputVal);
96701
96709
 
@@ -97040,7 +97048,13 @@ class transfer_Transfer extends baseComponent_BaseComponent {
97040
97048
  }
97041
97049
 
97042
97050
  onInputChange(value) {
97043
- 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);
97044
97058
  }
97045
97059
 
97046
97060
  onSelectOrRemove(item) {
@@ -100352,9 +100366,9 @@ class previewFooterFoundation_PreviewFooterFoundation extends foundation {
100352
100366
  } = this.getProps();
100353
100367
 
100354
100368
  if (value > zoom) {
100355
- onZoomIn(value / 100);
100369
+ onZoomIn(Number((value / 100).toFixed(2)));
100356
100370
  } else {
100357
- onZoomOut(value / 100);
100371
+ onZoomOut(Number((value / 100).toFixed(2)));
100358
100372
  }
100359
100373
 
100360
100374
  this._adapter.setStartMouseOffset(value);
@@ -101281,7 +101295,7 @@ previewImage_PreviewImage.propTypes = {
101281
101295
  zoomStep: prop_types_default.a.number,
101282
101296
  zoom: prop_types_default.a.number,
101283
101297
  ratio: prop_types_default.a.string,
101284
- disableDownload: prop_types_default.a.number,
101298
+ disableDownload: prop_types_default.a.bool,
101285
101299
  clickZoom: prop_types_default.a.number,
101286
101300
  setRatio: prop_types_default.a.func,
101287
101301
  onZoom: prop_types_default.a.func,
@@ -101511,7 +101525,7 @@ class previewInnerFoundation_PreviewInnerFoundation extends foundation {
101511
101525
  });
101512
101526
  }
101513
101527
 
101514
- this._adapter.notifyChange(newIndex);
101528
+ this._adapter.notifyChange(newIndex, direction);
101515
101529
 
101516
101530
  this.setState({
101517
101531
  direction,
@@ -101823,11 +101837,19 @@ class previewInner_PreviewInner extends baseComponent_BaseComponent {
101823
101837
  get adapter() {
101824
101838
  return Object.assign(Object.assign({}, super.adapter), {
101825
101839
  getIsInGroup: () => this.isInGroup(),
101826
- notifyChange: index => {
101840
+ notifyChange: (index, direction) => {
101827
101841
  const {
101828
- onChange
101842
+ onChange,
101843
+ onPrev,
101844
+ onNext
101829
101845
  } = this.props;
101830
101846
  isFunction_default()(onChange) && onChange(index);
101847
+
101848
+ if (direction === "prev") {
101849
+ onPrev && onPrev(index);
101850
+ } else {
101851
+ onNext && onNext(index);
101852
+ }
101831
101853
  },
101832
101854
  notifyZoom: (zoom, increase) => {
101833
101855
  const {
@@ -101861,9 +101883,9 @@ class previewInner_PreviewInner extends baseComponent_BaseComponent {
101861
101883
  },
101862
101884
  notifyRotateChange: angle => {
101863
101885
  const {
101864
- onRotateChange
101886
+ onRotateLeft
101865
101887
  } = this.props;
101866
- isFunction_default()(onRotateChange) && onRotateChange(angle);
101888
+ isFunction_default()(onRotateLeft) && onRotateLeft(angle);
101867
101889
  },
101868
101890
  notifyDownload: (src, index) => {
101869
101891
  const {
@@ -102121,7 +102143,7 @@ previewInner_PreviewInner.propTypes = {
102121
102143
  onNext: prop_types_default.a.func,
102122
102144
  onDownload: prop_types_default.a.func,
102123
102145
  onRatioChange: prop_types_default.a.func,
102124
- onRotateChange: prop_types_default.a.func
102146
+ onRotateLeft: prop_types_default.a.func
102125
102147
  };
102126
102148
  previewInner_PreviewInner.defaultProps = {
102127
102149
  showTooltip: false,
@@ -102198,7 +102220,7 @@ class imageFoundation_ImageFoundation extends foundation {
102198
102220
  } = preview;
102199
102221
  onVisibleChange && onVisibleChange(newVisible);
102200
102222
 
102201
- if (!("visible" in this.getProps())) {
102223
+ if (!("visible" in preview)) {
102202
102224
  this.setState({
102203
102225
  previewVisible: newVisible
102204
102226
  });
@@ -102218,6 +102240,7 @@ var image_image = __webpack_require__("txvO");
102218
102240
  // CONCATENATED MODULE: ./image/image.tsx
102219
102241
 
102220
102242
 
102243
+
102221
102244
  /* eslint-disable jsx-a11y/click-events-have-key-events */
102222
102245
 
102223
102246
  /* eslint-disable jsx-a11y/no-static-element-interactions */
@@ -102349,6 +102372,16 @@ class image_Image extends baseComponent_BaseComponent {
102349
102372
  willUpdateStates.loadStatus = "loading";
102350
102373
  }
102351
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
+
102352
102385
  return willUpdateStates;
102353
102386
  }
102354
102387
 
@@ -102709,8 +102742,8 @@ preview_Preview.propTypes = {
102709
102742
  onPrev: prop_types_default.a.func,
102710
102743
  onNext: prop_types_default.a.func,
102711
102744
  onDownload: prop_types_default.a.func,
102712
- onRatioChange: prop_types_default.a.func,
102713
- onRotateChange: prop_types_default.a.func
102745
+ onRotateLeft: prop_types_default.a.func,
102746
+ onRatioChange: prop_types_default.a.func
102714
102747
  };
102715
102748
  preview_Preview.defaultProps = {
102716
102749
  src: [],