@douyinfe/semi-ui 2.54.0-beta.0 → 2.54.1

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.
@@ -22975,7 +22975,9 @@ class Base extends external_root_React_commonjs2_react_commonjs_react_amd_react_
22975
22975
  expandable,
22976
22976
  expandText
22977
22977
  } = this.getEllipsisOpt();
22978
- const overflowed = !expanded && (isOverflowed || isTruncated);
22978
+ const canUseCSSEllipsis = this.canUseCSSEllipsis();
22979
+ // If the css is truncated, use isOverflowed to judge. If the css is truncated, use isTruncated to judge.
22980
+ const overflowed = !expanded && (canUseCSSEllipsis ? isOverflowed : isTruncated);
22979
22981
  const noExpandText = !expandable && isUndefined_default()(expandText);
22980
22982
  const show = noExpandText && overflowed && showTooltip;
22981
22983
  if (!show) {
@@ -23285,7 +23287,7 @@ class Base extends external_root_React_commonjs2_react_commonjs_react_amd_react_
23285
23287
  newState.isOverflowed = false;
23286
23288
  newState.ellipsisContent = props.children;
23287
23289
  newState.expanded = false;
23288
- newState.isTruncated = false;
23290
+ newState.isTruncated = true;
23289
23291
  }
23290
23292
  return newState;
23291
23293
  }
@@ -26916,8 +26918,8 @@ class Avatar extends BaseComponent {
26916
26918
  }
26917
26919
  }
26918
26920
  render() {
26919
- var _a, _b;
26920
- const _c = this.props,
26921
+ var _a;
26922
+ const _b = this.props,
26921
26923
  {
26922
26924
  shape,
26923
26925
  children,
@@ -26936,8 +26938,8 @@ class Avatar extends BaseComponent {
26936
26938
  topSlot,
26937
26939
  border,
26938
26940
  contentMotion
26939
- } = _c,
26940
- others = avatar_rest(_c, ["shape", "children", "size", "color", "className", "hoverMask", "onClick", "imgAttr", "src", "srcSet", "style", "alt", "gap", "bottomSlot", "topSlot", "border", "contentMotion"]);
26941
+ } = _b,
26942
+ others = avatar_rest(_b, ["shape", "children", "size", "color", "className", "hoverMask", "onClick", "imgAttr", "src", "srcSet", "style", "alt", "gap", "bottomSlot", "topSlot", "border", "contentMotion"]);
26941
26943
  const {
26942
26944
  isImgExist,
26943
26945
  hoverContent,
@@ -26967,8 +26969,8 @@ class Avatar extends BaseComponent {
26967
26969
  }), this.getContent(), hoverRender);
26968
26970
  if (border) {
26969
26971
  const borderStyle = {};
26970
- if (border === null || border === void 0 ? void 0 : border.color) {
26971
- borderStyle['borderColor'] = border.color;
26972
+ if (typeof border === 'object' && (border === null || border === void 0 ? void 0 : border.color)) {
26973
+ borderStyle['borderColor'] = border === null || border === void 0 ? void 0 : border.color;
26972
26974
  }
26973
26975
  avatar = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
26974
26976
  style: Object.assign({
@@ -26979,11 +26981,11 @@ class Avatar extends BaseComponent {
26979
26981
  className: classnames_default()([`${avatar_prefixCls}-additionalBorder`, `${avatar_prefixCls}-additionalBorder-${size}`, {
26980
26982
  [`${avatar_prefixCls}-${shape}`]: shape
26981
26983
  }])
26982
- }), ((_a = this.props.border) === null || _a === void 0 ? void 0 : _a.motion) && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
26984
+ }), typeof this.props.border === 'object' && this.props.border.motion && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
26983
26985
  style: borderStyle,
26984
26986
  className: classnames_default()([`${avatar_prefixCls}-additionalBorder`, `${avatar_prefixCls}-additionalBorder-${size}`, {
26985
26987
  [`${avatar_prefixCls}-${shape}`]: shape,
26986
- [`${avatar_prefixCls}-additionalBorder-animated`]: (_b = this.props.border) === null || _b === void 0 ? void 0 : _b.motion
26988
+ [`${avatar_prefixCls}-additionalBorder-animated`]: typeof this.props.border === 'object' && ((_a = this.props.border) === null || _a === void 0 ? void 0 : _a.motion)
26987
26989
  }])
26988
26990
  }));
26989
26991
  }
@@ -65943,7 +65945,8 @@ class NavigationFoundation extends foundation {
65943
65945
  items: formattedItems
65944
65946
  };
65945
65947
  } else {
65946
- this._adapter.updateSelectedKeys(willSelectedKeys);
65948
+ // already include parentSelectKeys, set second parameter to false
65949
+ this._adapter.updateSelectedKeys(willSelectedKeys, false);
65947
65950
  this._adapter.setItemKeysMap(itemKeysMap);
65948
65951
  this._adapter.updateOpenKeys(willOpenKeys);
65949
65952
  this._adapter.updateItems(formattedItems);
@@ -67190,24 +67193,19 @@ class Nav extends BaseComponent {
67190
67193
  componentDidMount() {
67191
67194
  // override BaseComponent
67192
67195
  }
67193
- componentDidUpdate(prevProps, prevState) {
67196
+ componentDidUpdate(prevProps) {
67194
67197
  if (prevProps.items !== this.props.items || prevProps.children !== this.props.children) {
67195
67198
  this.foundation.init();
67196
67199
  } else {
67197
67200
  this.foundation.handleItemsChange(false);
67198
- const {
67199
- selectedKeys
67200
- } = this.state;
67201
67201
  if (this.props.selectedKeys && !isEqual_default()(prevProps.selectedKeys, this.props.selectedKeys)) {
67202
67202
  this.adapter.updateSelectedKeys(this.props.selectedKeys);
67203
+ const willOpenKeys = this.foundation.getWillOpenKeys(this.state.itemKeysMap);
67204
+ this.adapter.updateOpenKeys(willOpenKeys);
67203
67205
  }
67204
67206
  if (this.props.openKeys && !isEqual_default()(prevProps.openKeys, this.props.openKeys)) {
67205
67207
  this.adapter.updateOpenKeys(this.props.openKeys);
67206
67208
  }
67207
- if (!isEqual_default()(selectedKeys, prevState.selectedKeys)) {
67208
- const parentSelectKeys = this.foundation.selectLevelZeroParentKeys(null, ...selectedKeys);
67209
- this.adapter.addSelectedKeys(...parentSelectKeys);
67210
- }
67211
67209
  }
67212
67210
  }
67213
67211
  get adapter() {
@@ -67233,9 +67231,20 @@ class Nav extends BaseComponent {
67233
67231
  }),
67234
67232
  addSelectedKeys: createAddKeysFn(this, 'selectedKeys'),
67235
67233
  removeSelectedKeys: createRemoveKeysFn(this, 'selectedKeys'),
67236
- updateSelectedKeys: selectedKeys => this.setState({
67237
- selectedKeys: [...selectedKeys]
67238
- }),
67234
+ /**
67235
+ * when `includeParentKeys` is `true`, select a nested nav item will select parent nav sub
67236
+ */
67237
+ updateSelectedKeys: function (selectedKeys) {
67238
+ let includeParentKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
67239
+ let willUpdateSelectedKeys = selectedKeys;
67240
+ if (includeParentKeys) {
67241
+ const parentSelectKeys = _this.foundation.selectLevelZeroParentKeys(null, selectedKeys);
67242
+ willUpdateSelectedKeys = Array.from(new Set(selectedKeys.concat(parentSelectKeys)));
67243
+ }
67244
+ _this.setState({
67245
+ selectedKeys: willUpdateSelectedKeys
67246
+ });
67247
+ },
67239
67248
  updateOpenKeys: openKeys => this.setState({
67240
67249
  openKeys: [...openKeys]
67241
67250
  }),