@douyinfe/semi-ui 2.54.0-beta.0 → 2.54.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.
@@ -284,8 +284,8 @@ class Avatar extends _baseComponent.default {
284
284
  }
285
285
  }
286
286
  render() {
287
- var _a, _b;
288
- const _c = this.props,
287
+ var _a;
288
+ const _b = this.props,
289
289
  {
290
290
  shape,
291
291
  children,
@@ -304,8 +304,8 @@ class Avatar extends _baseComponent.default {
304
304
  topSlot,
305
305
  border,
306
306
  contentMotion
307
- } = _c,
308
- others = __rest(_c, ["shape", "children", "size", "color", "className", "hoverMask", "onClick", "imgAttr", "src", "srcSet", "style", "alt", "gap", "bottomSlot", "topSlot", "border", "contentMotion"]);
307
+ } = _b,
308
+ others = __rest(_b, ["shape", "children", "size", "color", "className", "hoverMask", "onClick", "imgAttr", "src", "srcSet", "style", "alt", "gap", "bottomSlot", "topSlot", "border", "contentMotion"]);
309
309
  const {
310
310
  isImgExist,
311
311
  hoverContent,
@@ -335,8 +335,8 @@ class Avatar extends _baseComponent.default {
335
335
  }), this.getContent(), hoverRender);
336
336
  if (border) {
337
337
  const borderStyle = {};
338
- if (border === null || border === void 0 ? void 0 : border.color) {
339
- borderStyle['borderColor'] = border.color;
338
+ if (typeof border === 'object' && (border === null || border === void 0 ? void 0 : border.color)) {
339
+ borderStyle['borderColor'] = border === null || border === void 0 ? void 0 : border.color;
340
340
  }
341
341
  avatar = /*#__PURE__*/_react.default.createElement("div", {
342
342
  style: Object.assign({
@@ -347,11 +347,11 @@ class Avatar extends _baseComponent.default {
347
347
  className: (0, _classnames.default)([`${prefixCls}-additionalBorder`, `${prefixCls}-additionalBorder-${size}`, {
348
348
  [`${prefixCls}-${shape}`]: shape
349
349
  }])
350
- }), ((_a = this.props.border) === null || _a === void 0 ? void 0 : _a.motion) && /*#__PURE__*/_react.default.createElement("span", {
350
+ }), typeof this.props.border === 'object' && this.props.border.motion && /*#__PURE__*/_react.default.createElement("span", {
351
351
  style: borderStyle,
352
352
  className: (0, _classnames.default)([`${prefixCls}-additionalBorder`, `${prefixCls}-additionalBorder-${size}`, {
353
353
  [`${prefixCls}-${shape}`]: shape,
354
- [`${prefixCls}-additionalBorder-animated`]: (_b = this.props.border) === null || _b === void 0 ? void 0 : _b.motion
354
+ [`${prefixCls}-additionalBorder-animated`]: typeof this.props.border === 'object' && ((_a = this.props.border) === null || _a === void 0 ? void 0 : _a.motion)
355
355
  }])
356
356
  }));
357
357
  }
@@ -39,7 +39,7 @@ export interface AvatarProps extends BaseProps {
39
39
  border?: {
40
40
  color?: string;
41
41
  motion?: boolean;
42
- } & boolean;
42
+ } | boolean;
43
43
  contentMotion?: boolean;
44
44
  }
45
45
  export type AvatarGroupShape = 'circle' | 'square';
@@ -147,7 +147,9 @@ class Base extends _react.Component {
147
147
  expandable,
148
148
  expandText
149
149
  } = this.getEllipsisOpt();
150
- const overflowed = !expanded && (isOverflowed || isTruncated);
150
+ const canUseCSSEllipsis = this.canUseCSSEllipsis();
151
+ // If the css is truncated, use isOverflowed to judge. If the css is truncated, use isTruncated to judge.
152
+ const overflowed = !expanded && (canUseCSSEllipsis ? isOverflowed : isTruncated);
151
153
  const noExpandText = !expandable && (0, _isUndefined2.default)(expandText);
152
154
  const show = noExpandText && overflowed && showTooltip;
153
155
  if (!show) {
@@ -457,7 +459,7 @@ class Base extends _react.Component {
457
459
  newState.isOverflowed = false;
458
460
  newState.ellipsisContent = props.children;
459
461
  newState.expanded = false;
460
- newState.isTruncated = false;
462
+ newState.isTruncated = true;
461
463
  }
462
464
  return newState;
463
465
  }
@@ -6,9 +6,9 @@ import BaseComponent from '../_base/baseComponent';
6
6
  import type { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError } from './interface';
7
7
  import { Locale } from '../locale/interface';
8
8
  import '@douyinfe/semi-foundation/lib/cjs/upload/upload.css';
9
- import type { CustomFile, UploadAdapter, BeforeUploadObjectResult, AfterUploadResult } from '@douyinfe/semi-foundation/lib/cjs/upload/foundation';
9
+ import type { CustomFile, UploadAdapter, BeforeUploadObjectResult, AfterUploadResult, FileItemStatus } from '@douyinfe/semi-foundation/lib/cjs/upload/foundation';
10
10
  import type { ValidateStatus } from '../_base/baseComponent';
11
- export type { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError, BeforeUploadObjectResult, AfterUploadResult, };
11
+ export type { FileItem, FileItemStatus, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError, BeforeUploadObjectResult, AfterUploadResult, };
12
12
  export interface UploadProps {
13
13
  accept?: string;
14
14
  action: string;
@@ -265,8 +265,8 @@ export default class Avatar extends BaseComponent {
265
265
  }
266
266
  }
267
267
  render() {
268
- var _a, _b;
269
- const _c = this.props,
268
+ var _a;
269
+ const _b = this.props,
270
270
  {
271
271
  shape,
272
272
  children,
@@ -285,8 +285,8 @@ export default class Avatar extends BaseComponent {
285
285
  topSlot,
286
286
  border,
287
287
  contentMotion
288
- } = _c,
289
- others = __rest(_c, ["shape", "children", "size", "color", "className", "hoverMask", "onClick", "imgAttr", "src", "srcSet", "style", "alt", "gap", "bottomSlot", "topSlot", "border", "contentMotion"]);
288
+ } = _b,
289
+ others = __rest(_b, ["shape", "children", "size", "color", "className", "hoverMask", "onClick", "imgAttr", "src", "srcSet", "style", "alt", "gap", "bottomSlot", "topSlot", "border", "contentMotion"]);
290
290
  const {
291
291
  isImgExist,
292
292
  hoverContent,
@@ -316,8 +316,8 @@ export default class Avatar extends BaseComponent {
316
316
  }), this.getContent(), hoverRender);
317
317
  if (border) {
318
318
  const borderStyle = {};
319
- if (border === null || border === void 0 ? void 0 : border.color) {
320
- borderStyle['borderColor'] = border.color;
319
+ if (typeof border === 'object' && (border === null || border === void 0 ? void 0 : border.color)) {
320
+ borderStyle['borderColor'] = border === null || border === void 0 ? void 0 : border.color;
321
321
  }
322
322
  avatar = /*#__PURE__*/React.createElement("div", {
323
323
  style: Object.assign({
@@ -328,11 +328,11 @@ export default class Avatar extends BaseComponent {
328
328
  className: cls([`${prefixCls}-additionalBorder`, `${prefixCls}-additionalBorder-${size}`, {
329
329
  [`${prefixCls}-${shape}`]: shape
330
330
  }])
331
- }), ((_a = this.props.border) === null || _a === void 0 ? void 0 : _a.motion) && /*#__PURE__*/React.createElement("span", {
331
+ }), typeof this.props.border === 'object' && this.props.border.motion && /*#__PURE__*/React.createElement("span", {
332
332
  style: borderStyle,
333
333
  className: cls([`${prefixCls}-additionalBorder`, `${prefixCls}-additionalBorder-${size}`, {
334
334
  [`${prefixCls}-${shape}`]: shape,
335
- [`${prefixCls}-additionalBorder-animated`]: (_b = this.props.border) === null || _b === void 0 ? void 0 : _b.motion
335
+ [`${prefixCls}-additionalBorder-animated`]: typeof this.props.border === 'object' && ((_a = this.props.border) === null || _a === void 0 ? void 0 : _a.motion)
336
336
  }])
337
337
  }));
338
338
  }
@@ -39,7 +39,7 @@ export interface AvatarProps extends BaseProps {
39
39
  border?: {
40
40
  color?: string;
41
41
  motion?: boolean;
42
- } & boolean;
42
+ } | boolean;
43
43
  contentMotion?: boolean;
44
44
  }
45
45
  export type AvatarGroupShape = 'circle' | 'square';
@@ -138,7 +138,9 @@ export default class Base extends Component {
138
138
  expandable,
139
139
  expandText
140
140
  } = this.getEllipsisOpt();
141
- const overflowed = !expanded && (isOverflowed || isTruncated);
141
+ const canUseCSSEllipsis = this.canUseCSSEllipsis();
142
+ // If the css is truncated, use isOverflowed to judge. If the css is truncated, use isTruncated to judge.
143
+ const overflowed = !expanded && (canUseCSSEllipsis ? isOverflowed : isTruncated);
142
144
  const noExpandText = !expandable && _isUndefined(expandText);
143
145
  const show = noExpandText && overflowed && showTooltip;
144
146
  if (!show) {
@@ -448,7 +450,7 @@ export default class Base extends Component {
448
450
  newState.isOverflowed = false;
449
451
  newState.ellipsisContent = props.children;
450
452
  newState.expanded = false;
451
- newState.isTruncated = false;
453
+ newState.isTruncated = true;
452
454
  }
453
455
  return newState;
454
456
  }
@@ -6,9 +6,9 @@ import BaseComponent from '../_base/baseComponent';
6
6
  import type { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError } from './interface';
7
7
  import { Locale } from '../locale/interface';
8
8
  import '@douyinfe/semi-foundation/lib/es/upload/upload.css';
9
- import type { CustomFile, UploadAdapter, BeforeUploadObjectResult, AfterUploadResult } from '@douyinfe/semi-foundation/lib/es/upload/foundation';
9
+ import type { CustomFile, UploadAdapter, BeforeUploadObjectResult, AfterUploadResult, FileItemStatus } from '@douyinfe/semi-foundation/lib/es/upload/foundation';
10
10
  import type { ValidateStatus } from '../_base/baseComponent';
11
- export type { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError, BeforeUploadObjectResult, AfterUploadResult, };
11
+ export type { FileItem, FileItemStatus, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError, BeforeUploadObjectResult, AfterUploadResult, };
12
12
  export interface UploadProps {
13
13
  accept?: string;
14
14
  action: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.54.0-beta.0",
3
+ "version": "2.54.0",
4
4
  "description": "A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -20,12 +20,12 @@
20
20
  "@dnd-kit/core": "^6.0.8",
21
21
  "@dnd-kit/sortable": "^7.0.2",
22
22
  "@dnd-kit/utilities": "^3.2.1",
23
- "@douyinfe/semi-animation": "2.54.0-beta.0",
24
- "@douyinfe/semi-animation-react": "2.54.0-beta.0",
25
- "@douyinfe/semi-foundation": "2.54.0-beta.0",
26
- "@douyinfe/semi-icons": "2.54.0-beta.0",
27
- "@douyinfe/semi-illustrations": "2.54.0-beta.0",
28
- "@douyinfe/semi-theme-default": "2.54.0-beta.0",
23
+ "@douyinfe/semi-animation": "2.54.0",
24
+ "@douyinfe/semi-animation-react": "2.54.0",
25
+ "@douyinfe/semi-foundation": "2.54.0",
26
+ "@douyinfe/semi-icons": "2.54.0",
27
+ "@douyinfe/semi-illustrations": "2.54.0",
28
+ "@douyinfe/semi-theme-default": "2.54.0",
29
29
  "async-validator": "^3.5.0",
30
30
  "classnames": "^2.2.6",
31
31
  "copy-text-to-clipboard": "^2.1.1",
@@ -75,7 +75,7 @@
75
75
  ],
76
76
  "author": "",
77
77
  "license": "MIT",
78
- "gitHead": "b661fb2006bd11849e02af7f8e1b412c59b94781",
78
+ "gitHead": "30c24d26549ecb166625ef4f0a731235b71968fc",
79
79
  "devDependencies": {
80
80
  "@babel/plugin-proposal-decorators": "^7.15.8",
81
81
  "@babel/plugin-transform-runtime": "^7.15.8",