@douyinfe/semi-ui 2.20.0-beta.1 → 2.20.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.
Files changed (105) hide show
  1. package/dist/css/semi.css +11 -0
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +88 -127
  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/anchor/index.d.ts +1 -1
  8. package/lib/cjs/backtop/index.js +4 -1
  9. package/lib/cjs/breadcrumb/index.d.ts +1 -1
  10. package/lib/cjs/breadcrumb/item.d.ts +1 -1
  11. package/lib/cjs/button/buttonGroup.js +3 -1
  12. package/lib/cjs/button/index.d.ts +4 -4
  13. package/lib/cjs/calendar/index.d.ts +1 -1
  14. package/lib/cjs/calendar/interface.d.ts +3 -3
  15. package/lib/cjs/card/index.d.ts +2 -2
  16. package/lib/cjs/cascader/index.d.ts +2 -2
  17. package/lib/cjs/checkbox/index.d.ts +3 -2
  18. package/lib/cjs/collapse/index.d.ts +2 -2
  19. package/lib/cjs/datePicker/index.d.ts +7 -7
  20. package/lib/cjs/descriptions/index.d.ts +1 -1
  21. package/lib/cjs/dropdown/dropdownItem.d.ts +3 -2
  22. package/lib/cjs/dropdown/index.d.ts +4 -4
  23. package/lib/cjs/form/arrayField.d.ts +1 -1
  24. package/lib/cjs/form/group.js +47 -6
  25. package/lib/cjs/form/index.d.ts +6 -6
  26. package/lib/cjs/grid/index.d.ts +2 -2
  27. package/lib/cjs/icons/index.d.ts +1 -1
  28. package/lib/cjs/input/index.d.ts +2 -2
  29. package/lib/cjs/layout/index.d.ts +1 -1
  30. package/lib/cjs/list/index.d.ts +1 -1
  31. package/lib/cjs/modal/Modal.d.ts +1 -1
  32. package/lib/cjs/modal/index.d.ts +2 -2
  33. package/lib/cjs/navigation/index.d.ts +7 -7
  34. package/lib/cjs/notification/index.d.ts +2 -2
  35. package/lib/cjs/overflowList/index.d.ts +1 -1
  36. package/lib/cjs/pagination/index.d.ts +1 -1
  37. package/lib/cjs/popover/index.d.ts +2 -1
  38. package/lib/cjs/radio/index.d.ts +3 -3
  39. package/lib/cjs/radio/radio.d.ts +1 -1
  40. package/lib/cjs/rating/index.d.ts +1 -1
  41. package/lib/cjs/scrollList/index.d.ts +1 -1
  42. package/lib/cjs/select/index.d.ts +3 -3
  43. package/lib/cjs/sideSheet/index.d.ts +3 -3
  44. package/lib/cjs/skeleton/index.d.ts +1 -1
  45. package/lib/cjs/slider/index.d.ts +1 -1
  46. package/lib/cjs/steps/index.d.ts +7 -7
  47. package/lib/cjs/table/Table.js +1 -1
  48. package/lib/cjs/timePicker/index.d.ts +5 -5
  49. package/lib/cjs/timeline/index.d.ts +1 -1
  50. package/lib/cjs/toast/index.d.ts +2 -2
  51. package/lib/cjs/tooltip/index.d.ts +2 -2
  52. package/lib/cjs/tree/index.d.ts +1 -1
  53. package/lib/cjs/tree/index.js +13 -1
  54. package/lib/cjs/typography/index.d.ts +5 -5
  55. package/lib/cjs/upload/index.d.ts +4 -2
  56. package/lib/es/anchor/index.d.ts +1 -1
  57. package/lib/es/backtop/index.js +4 -1
  58. package/lib/es/breadcrumb/index.d.ts +1 -1
  59. package/lib/es/breadcrumb/item.d.ts +1 -1
  60. package/lib/es/button/buttonGroup.js +3 -1
  61. package/lib/es/button/index.d.ts +4 -4
  62. package/lib/es/calendar/index.d.ts +1 -1
  63. package/lib/es/calendar/interface.d.ts +3 -3
  64. package/lib/es/card/index.d.ts +2 -2
  65. package/lib/es/cascader/index.d.ts +2 -2
  66. package/lib/es/checkbox/index.d.ts +3 -2
  67. package/lib/es/collapse/index.d.ts +2 -2
  68. package/lib/es/datePicker/index.d.ts +7 -7
  69. package/lib/es/descriptions/index.d.ts +1 -1
  70. package/lib/es/dropdown/dropdownItem.d.ts +3 -2
  71. package/lib/es/dropdown/index.d.ts +4 -4
  72. package/lib/es/form/arrayField.d.ts +1 -1
  73. package/lib/es/form/group.js +43 -6
  74. package/lib/es/form/index.d.ts +6 -6
  75. package/lib/es/grid/index.d.ts +2 -2
  76. package/lib/es/icons/index.d.ts +1 -1
  77. package/lib/es/input/index.d.ts +2 -2
  78. package/lib/es/layout/index.d.ts +1 -1
  79. package/lib/es/list/index.d.ts +1 -1
  80. package/lib/es/modal/Modal.d.ts +1 -1
  81. package/lib/es/modal/index.d.ts +2 -2
  82. package/lib/es/navigation/index.d.ts +7 -7
  83. package/lib/es/notification/index.d.ts +2 -2
  84. package/lib/es/overflowList/index.d.ts +1 -1
  85. package/lib/es/pagination/index.d.ts +1 -1
  86. package/lib/es/popover/index.d.ts +2 -1
  87. package/lib/es/radio/index.d.ts +3 -3
  88. package/lib/es/radio/radio.d.ts +1 -1
  89. package/lib/es/rating/index.d.ts +1 -1
  90. package/lib/es/scrollList/index.d.ts +1 -1
  91. package/lib/es/select/index.d.ts +3 -3
  92. package/lib/es/sideSheet/index.d.ts +3 -3
  93. package/lib/es/skeleton/index.d.ts +1 -1
  94. package/lib/es/slider/index.d.ts +1 -1
  95. package/lib/es/steps/index.d.ts +7 -7
  96. package/lib/es/table/Table.js +1 -1
  97. package/lib/es/timePicker/index.d.ts +5 -5
  98. package/lib/es/timeline/index.d.ts +1 -1
  99. package/lib/es/toast/index.d.ts +2 -2
  100. package/lib/es/tooltip/index.d.ts +2 -2
  101. package/lib/es/tree/index.d.ts +1 -1
  102. package/lib/es/tree/index.js +13 -1
  103. package/lib/es/typography/index.d.ts +5 -5
  104. package/lib/es/upload/index.d.ts +4 -2
  105. package/package.json +7 -7
@@ -3,7 +3,7 @@ import BaseComponent, { BaseProps } from '../_base/baseComponent';
3
3
  import propTypes from 'prop-types';
4
4
  import ScrollItem from './scrollItem';
5
5
  import '@douyinfe/semi-foundation/lib/es/scrollList/scrollList.css';
6
- export { ScrollItemProps } from './scrollItem';
6
+ export type { ScrollItemProps } from './scrollItem';
7
7
  export interface ScrollListProps extends BaseProps {
8
8
  header?: React.ReactNode;
9
9
  footer?: React.ReactNode;
@@ -9,9 +9,9 @@ import OptionGroup from './optionGroup';
9
9
  import { Subtract } from 'utility-types';
10
10
  import '@douyinfe/semi-foundation/lib/es/select/select.css';
11
11
  import { Position, TooltipProps } from '../tooltip';
12
- export { OptionProps } from './option';
13
- export { OptionGroupProps } from './optionGroup';
14
- export { VirtualRowProps } from './virtualRow';
12
+ export type { OptionProps } from './option';
13
+ export type { OptionGroupProps } from './optionGroup';
14
+ export type { VirtualRowProps } from './virtualRow';
15
15
  declare type ExcludeInputType = {
16
16
  value?: InputProps['value'];
17
17
  onFocus?: InputProps['onFocus'];
@@ -4,8 +4,8 @@ import PropTypes from 'prop-types';
4
4
  import { ContextValue } from '../configProvider/context';
5
5
  import { SideSheetAdapter, SideSheetProps, SideSheetState } from '@douyinfe/semi-foundation/lib/es/sideSheet/sideSheetFoundation';
6
6
  import '@douyinfe/semi-foundation/lib/es/sideSheet/sideSheet.css';
7
- export { SideSheetContentProps } from './SideSheetContent';
8
- export { SideSheetTransitionProps } from './SideSheetTransition';
7
+ export type { SideSheetContentProps } from './SideSheetContent';
8
+ export type { SideSheetTransitionProps } from './SideSheetTransition';
9
9
  export interface SideSheetReactProps extends SideSheetProps {
10
10
  bodyStyle?: CSSProperties;
11
11
  headerStyle?: CSSProperties;
@@ -16,7 +16,7 @@ export interface SideSheetReactProps extends SideSheetProps {
16
16
  children?: React.ReactNode;
17
17
  onCancel?: (e: React.MouseEvent | React.KeyboardEvent) => void;
18
18
  }
19
- export { SideSheetState };
19
+ export type { SideSheetState };
20
20
  export default class SideSheet extends BaseComponent<SideSheetReactProps, SideSheetState> {
21
21
  static contextType: React.Context<ContextValue>;
22
22
  static propTypes: {
@@ -2,7 +2,7 @@ import React, { PureComponent, ReactNode, CSSProperties } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import '@douyinfe/semi-foundation/lib/es/skeleton/skeleton.css';
4
4
  import { Paragraph } from './item';
5
- export { ParagraphProps, AvatarProps, GenericProps } from './item';
5
+ export type { ParagraphProps, AvatarProps, GenericProps } from './item';
6
6
  export interface SkeletonProps {
7
7
  active?: boolean;
8
8
  children?: ReactNode;
@@ -6,7 +6,7 @@ export interface SliderProps extends BasicSliceProps {
6
6
  style?: CSSProperties;
7
7
  railStyle?: CSSProperties;
8
8
  }
9
- export { SliderState };
9
+ export type { SliderState };
10
10
  export default class Slider extends BaseComponent<SliderProps, SliderState> {
11
11
  static propTypes: any;
12
12
  static defaultProps: Partial<SliderProps>;
@@ -4,13 +4,13 @@ import '@douyinfe/semi-foundation/lib/es/steps/steps.css';
4
4
  import { FillStepsProps } from './fillSteps';
5
5
  import { BasicStepsProps } from './basicSteps';
6
6
  import { NavStepsProps } from './navSteps';
7
- export { Status, Size, BasicStepProps } from './basicStep';
8
- export { Direction, BasicStepsProps } from './basicSteps';
9
- export { FillStepProps } from './fillStep';
10
- export { FillStepsProps } from './fillSteps';
11
- export { NavStepProps } from './navStep';
12
- export { NavStepsProps } from './navSteps';
13
- export { StepProps } from './step';
7
+ export type { Status, Size, BasicStepProps } from './basicStep';
8
+ export type { Direction, BasicStepsProps } from './basicSteps';
9
+ export type { FillStepProps } from './fillStep';
10
+ export type { FillStepsProps } from './fillSteps';
11
+ export type { NavStepProps } from './navStep';
12
+ export type { NavStepsProps } from './navSteps';
13
+ export type { StepProps } from './step';
14
14
  export interface FillStepsAllProps extends FillStepsProps {
15
15
  type?: 'fill';
16
16
  }
@@ -856,7 +856,6 @@ class Table extends BaseComponent {
856
856
  this.store = new Store({
857
857
  hoveredRowKey: null
858
858
  });
859
- this.setScrollPosition('left');
860
859
  this.debouncedWindowResize = _debounce(this.handleWindowResize, 150);
861
860
  this.cachedFilteredSortedDataSource = [];
862
861
  this.cachedFilteredSortedRowKeys = [];
@@ -1163,6 +1162,7 @@ class Table extends BaseComponent {
1163
1162
 
1164
1163
  componentDidMount() {
1165
1164
  super.componentDidMount();
1165
+ this.setScrollPosition('left');
1166
1166
 
1167
1167
  if (this.adapter.isAnyColumnFixed() || this.props.showHeader && this.adapter.useFixedHeader()) {
1168
1168
  this.handleWindowResize();
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { TimePickerProps as BasePickerProps, BaseValueType } from './TimePicker';
3
- import { ValidateStatus } from '../_base/baseComponent';
4
- import { ScrollItemProps } from '../scrollList/scrollItem';
5
- export { TimeInputProps } from './TimeInput';
6
- export { TimePickerProps } from './TimePicker';
7
- export { BaseValueType, ScrollItemProps, ValidateStatus };
3
+ import type { ValidateStatus } from '../_base/baseComponent';
4
+ import type { ScrollItemProps } from '../scrollList/scrollItem';
5
+ export type { TimeInputProps } from './TimeInput';
6
+ export type { TimePickerProps } from './TimePicker';
7
+ export type { BaseValueType, ScrollItemProps, ValidateStatus };
8
8
  export declare type LocalePickerProps = BasePickerProps;
9
9
  export default class LocaleTimePicker extends React.PureComponent<LocalePickerProps> {
10
10
  static propTypes: {
@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
4
4
  import Item, { TimelineItemProps } from './item';
5
- export { TimelineItemProps } from './item';
5
+ export type { TimelineItemProps } from './item';
6
6
  export interface Data extends TimelineItemProps {
7
7
  content: React.ReactNode;
8
8
  }
@@ -5,14 +5,14 @@ import '@douyinfe/semi-foundation/lib/es/toast/toast.css';
5
5
  import useToast from './useToast';
6
6
  import { ConfigProps, ToastInstance, ToastProps, ToastState } from '@douyinfe/semi-foundation/lib/es/toast/toastFoundation';
7
7
  import { Motion } from '../_base/base';
8
- export { ToastTransitionProps } from './ToastTransition';
8
+ export type { ToastTransitionProps } from './ToastTransition';
9
9
  export interface ToastReactProps extends ToastProps {
10
10
  id?: string;
11
11
  style?: CSSProperties;
12
12
  icon?: React.ReactNode;
13
13
  content: React.ReactNode;
14
14
  }
15
- export { ConfigProps, ToastListProps, ToastListState, ToastState };
15
+ export type { ConfigProps, ToastListProps, ToastListState, ToastState };
16
16
  declare const createBaseToast: () => {
17
17
  new (props: ToastListProps): {
18
18
  readonly adapter: ToastListAdapter;
@@ -8,8 +8,9 @@ import '@douyinfe/semi-foundation/lib/es/tooltip/tooltip.css';
8
8
  import BaseComponent, { BaseProps } from '../_base/baseComponent';
9
9
  import { ContextValue } from '../configProvider/context';
10
10
  import { Motion } from '../_base/base';
11
- export { TooltipTransitionProps } from './TooltipStyledTransition';
11
+ export type { TooltipTransitionProps } from './TooltipStyledTransition';
12
12
  export declare type Trigger = ArrayElement<typeof strings.TRIGGER_SET>;
13
+ export type { Position };
13
14
  export interface ArrowBounding {
14
15
  offsetX?: number;
15
16
  offsetY?: number;
@@ -179,4 +180,3 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
179
180
  mergeEvents: (rawEvents: Record<string, any>, events: Record<string, any>) => {};
180
181
  render(): JSX.Element;
181
182
  }
182
- export { Position };
@@ -8,7 +8,7 @@ import TreeNode from './treeNode';
8
8
  import '@douyinfe/semi-foundation/lib/es/tree/tree.css';
9
9
  import { TreeProps, TreeState, TreeNodeProps, TreeNodeData, FlattenNode, KeyEntity, ScrollData } from './interface';
10
10
  export * from './interface';
11
- export { AutoSizerProps } from './autoSizer';
11
+ export type { AutoSizerProps } from './autoSizer';
12
12
  declare class Tree extends BaseComponent<TreeProps, TreeState> {
13
13
  static contextType: React.Context<ContextValue>;
14
14
  static propTypes: {
@@ -223,6 +223,8 @@ class Tree extends BaseComponent {
223
223
 
224
224
 
225
225
  static getDerivedStateFromProps(props, prevState) {
226
+ var _a;
227
+
226
228
  const {
227
229
  prevProps
228
230
  } = prevState;
@@ -304,8 +306,18 @@ class Tree extends BaseComponent {
304
306
  newState.expandedKeys = calcExpandedKeys(props.defaultExpandedKeys, keyEntities);
305
307
  } else if (!prevProps && props.defaultValue) {
306
308
  newState.expandedKeys = calcExpandedKeysForValues(props.defaultValue, keyEntities, props.multiple, valueEntities);
307
- } else if ((!prevProps || !isExpandControlled && dataUpdated) && props.value) {
309
+ } else if (!prevProps && props.value) {
308
310
  newState.expandedKeys = calcExpandedKeysForValues(props.value, keyEntities, props.multiple, valueEntities);
311
+ } else if (!isExpandControlled && dataUpdated && props.value) {
312
+ // 当 treeData 已经设置具体的值,并且设置了 props.loadData ,则认为 treeData 的更新是因为 loadData 导致的
313
+ // 如果是因为 loadData 导致 treeData改变, 此时在这里重新计算 key 会导致为未选中的展开项目被收起
314
+ // 所以此时不需要重新计算 expandedKeys,因为在点击展开按钮时候已经把被展开的项添加到 expandedKeys 中
315
+ // When treeData has a specific value and props.loadData is set, it is considered that the update of treeData is caused by loadData
316
+ // If the treeData is changed because of loadData, recalculating the key here will cause the unselected expanded items to be collapsed
317
+ // So there is no need to recalculate expandedKeys at this time, because the expanded item has been added to expandedKeys when the expand button is clicked
318
+ if (!(prevState.treeData && ((_a = prevState.treeData) === null || _a === void 0 ? void 0 : _a.length) > 0 && props.loadData)) {
319
+ newState.expandedKeys = calcExpandedKeysForValues(props.value, keyEntities, props.multiple, valueEntities);
320
+ }
309
321
  }
310
322
 
311
323
  if (!newState.expandedKeys) {
@@ -8,10 +8,10 @@ export declare type TypographyType = typeof BaseTypography & {
8
8
  Paragraph: typeof Paragraph;
9
9
  };
10
10
  declare const Typography: TypographyType;
11
- export { BaseTypographyProps } from './base';
12
- export { CopyableProps } from './copyable';
13
- export { TitleProps } from './title';
14
- export { TextProps } from './text';
15
- export { ParagraphProps } from './paragraph';
11
+ export type { BaseTypographyProps } from './base';
12
+ export type { CopyableProps } from './copyable';
13
+ export type { TitleProps } from './title';
14
+ export type { TextProps } from './text';
15
+ export type { ParagraphProps } from './paragraph';
16
16
  export * from './interface';
17
17
  export default Typography;
@@ -1,11 +1,13 @@
1
1
  import React, { ReactNode, CSSProperties, RefObject, ChangeEvent, DragEvent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import UploadFoundation, { CustomFile, UploadAdapter, BeforeUploadObjectResult, AfterUploadResult } from '@douyinfe/semi-foundation/lib/es/upload/foundation';
3
+ import UploadFoundation from '@douyinfe/semi-foundation/lib/es/upload/foundation';
4
4
  import FileCard from './fileCard';
5
- import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
5
+ import BaseComponent from '../_base/baseComponent';
6
6
  import { 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';
10
+ import type { ValidateStatus } from '../_base/baseComponent';
9
11
  export { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError, BeforeUploadObjectResult, AfterUploadResult, };
10
12
  export interface UploadProps {
11
13
  accept?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.20.0-beta.1",
3
+ "version": "2.20.1",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -18,11 +18,11 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "@douyinfe/semi-animation": "2.12.0",
21
- "@douyinfe/semi-animation-react": "2.20.0-beta.1",
22
- "@douyinfe/semi-foundation": "2.20.0-beta.1",
23
- "@douyinfe/semi-icons": "2.20.0-beta.1",
21
+ "@douyinfe/semi-animation-react": "2.20.1",
22
+ "@douyinfe/semi-foundation": "2.20.1",
23
+ "@douyinfe/semi-icons": "2.20.1",
24
24
  "@douyinfe/semi-illustrations": "2.15.0",
25
- "@douyinfe/semi-theme-default": "2.20.0-beta.1",
25
+ "@douyinfe/semi-theme-default": "2.20.1",
26
26
  "async-validator": "^3.5.0",
27
27
  "classnames": "^2.2.6",
28
28
  "copy-text-to-clipboard": "^2.1.1",
@@ -69,13 +69,13 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "5b995a1afab25994df894566bda7f29b70befa97",
72
+ "gitHead": "9f1920d30dcfaf74678976cf9fa16e2ed4bfc226",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",
76
76
  "@babel/preset-env": "^7.15.8",
77
77
  "@babel/preset-react": "^7.14.5",
78
- "@douyinfe/semi-scss-compile": "2.20.0-beta.1",
78
+ "@douyinfe/semi-scss-compile": "2.20.1",
79
79
  "@storybook/addon-knobs": "^6.3.1",
80
80
  "@types/lodash": "^4.14.176",
81
81
  "@types/react": ">=16.0.0",