@douyinfe/semi-ui 2.1.0-beta.1 → 2.1.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 (58) hide show
  1. package/dist/css/semi.css +1 -0
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +69 -65
  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/es/autoComplete/index.d.ts +36 -11
  8. package/lib/es/calendar/dayCalendar.js +1 -1
  9. package/lib/es/calendar/monthCalendar.js +1 -1
  10. package/lib/es/calendar/rangeCalendar.js +1 -1
  11. package/lib/es/calendar/weekCalendar.js +1 -1
  12. package/lib/es/cascader/index.d.ts +1 -1
  13. package/lib/es/collapse/index.js +1 -5
  14. package/lib/es/collapsible/index.js +4 -1
  15. package/lib/es/datePicker/index.d.ts +1 -1
  16. package/lib/es/datePicker/yearAndMonth.d.ts +2 -2
  17. package/lib/es/form/baseForm.d.ts +4 -10
  18. package/lib/es/form/baseForm.js +1 -2
  19. package/lib/es/form/field.d.ts +4 -22
  20. package/lib/es/form/field.js +2 -18
  21. package/lib/es/form/hoc/withField.d.ts +1 -1
  22. package/lib/es/form/hoc/withField.js +0 -3
  23. package/lib/es/locale/localeConsumer.d.ts +5 -5
  24. package/lib/es/modal/useModal/HookModal.d.ts +3 -2
  25. package/lib/es/modal/useModal/index.js +1 -1
  26. package/lib/es/navigation/index.d.ts +1 -1
  27. package/lib/es/notification/index.d.ts +1 -1
  28. package/lib/es/notification/index.js +1 -1
  29. package/lib/es/rating/index.d.ts +1 -1
  30. package/lib/es/resizeObserver/index.js +1 -0
  31. package/lib/es/scrollList/scrollItem.d.ts +12 -11
  32. package/lib/es/scrollList/scrollItem.js +8 -8
  33. package/lib/es/select/index.js +2 -2
  34. package/lib/es/select/option.js +2 -2
  35. package/lib/es/select/utils.js +2 -4
  36. package/lib/es/sideSheet/SideSheetContent.d.ts +1 -1
  37. package/lib/es/sideSheet/index.d.ts +3 -3
  38. package/lib/es/steps/basicSteps.js +2 -2
  39. package/lib/es/steps/fillSteps.js +3 -3
  40. package/lib/es/steps/navSteps.js +2 -2
  41. package/lib/es/table/interface.d.ts +2 -1
  42. package/lib/es/tabs/TabBar.d.ts +1 -1
  43. package/lib/es/tabs/index.d.ts +1 -1
  44. package/lib/es/tabs/index.js +5 -5
  45. package/lib/es/timePicker/Combobox.d.ts +10 -4
  46. package/lib/es/timePicker/Combobox.js +2 -1
  47. package/lib/es/timePicker/TimePicker.d.ts +1 -1
  48. package/lib/es/toast/index.d.ts +1 -1
  49. package/lib/es/treeSelect/index.js +2 -1
  50. package/lib/es/typography/base.d.ts +1 -1
  51. package/lib/es/typography/paragraph.d.ts +1 -1
  52. package/lib/es/typography/text.d.ts +1 -1
  53. package/lib/es/typography/title.d.ts +1 -1
  54. package/lib/es/upload/fileCard.d.ts +3 -18
  55. package/lib/es/upload/index.d.ts +4 -57
  56. package/lib/es/upload/interface.d.ts +56 -0
  57. package/lib/es/upload/interface.js +1 -0
  58. package/package.json +9 -8
@@ -2,7 +2,7 @@ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
2
2
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
3
3
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
4
4
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
5
- import React, { cloneElement, Children, useMemo } from 'react';
5
+ import React, { cloneElement, Children, useMemo, isValidElement } from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import cls from 'classnames';
8
8
  import { stepsClasses as css } from '@douyinfe/semi-foundation/lib/es/steps/constants';
@@ -26,7 +26,7 @@ const Steps = props => {
26
26
  const inner = useMemo(() => {
27
27
  var _context;
28
28
 
29
- const filteredChildren = _filterInstanceProperty(_context = Children.toArray(children)).call(_context, c => Boolean(c));
29
+ const filteredChildren = _filterInstanceProperty(_context = Children.toArray(children)).call(_context, c => /*#__PURE__*/isValidElement(c));
30
30
 
31
31
  const content = _mapInstanceProperty(Children).call(Children, filteredChildren, (child, index) => {
32
32
  if (!child) {
@@ -2,7 +2,7 @@ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
2
2
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
3
3
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
4
4
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
5
- import React, { cloneElement, Children, useMemo } from 'react';
5
+ import React, { cloneElement, Children, useMemo, isValidElement } from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import cls from 'classnames';
8
8
  import { stepsClasses as css } from '@douyinfe/semi-foundation/lib/es/steps/constants';
@@ -25,7 +25,7 @@ const Steps = props => {
25
25
  const inner = useMemo(() => {
26
26
  var _context;
27
27
 
28
- const filteredChildren = _filterInstanceProperty(_context = Children.toArray(children)).call(_context, c => Boolean(c));
28
+ const filteredChildren = _filterInstanceProperty(_context = Children.toArray(children)).call(_context, c => /*#__PURE__*/isValidElement(c));
29
29
 
30
30
  const colStyle = direction === 'vertical' ? null : {
31
31
  width: "".concat(100 / filteredChildren.length, "%")
@@ -69,7 +69,7 @@ const Steps = props => {
69
69
  });
70
70
 
71
71
  return content;
72
- }, [children, initial, prefixCls, direction, status, current]);
72
+ }, [children, initial, prefixCls, direction, status, current, onChange]);
73
73
  const wrapperCls = cls(className, {
74
74
  [prefixCls]: true,
75
75
  [_concatInstanceProperty(_context2 = "".concat(prefixCls, "-")).call(_context2, direction)]: true
@@ -2,7 +2,7 @@ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
2
2
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
3
3
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
4
4
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
5
- import React, { cloneElement, Children, useMemo } from 'react';
5
+ import React, { cloneElement, Children, useMemo, isValidElement } from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import cls from 'classnames';
8
8
  import { stepsClasses as css } from '@douyinfe/semi-foundation/lib/es/steps/constants';
@@ -23,7 +23,7 @@ const Steps = props => {
23
23
  const inner = useMemo(() => {
24
24
  var _context;
25
25
 
26
- const filteredChildren = _filterInstanceProperty(_context = Children.toArray(children)).call(_context, c => Boolean(c));
26
+ const filteredChildren = _filterInstanceProperty(_context = Children.toArray(children)).call(_context, c => /*#__PURE__*/isValidElement(c));
27
27
 
28
28
  const total = filteredChildren.length;
29
29
 
@@ -35,7 +35,7 @@ export interface TableProps<RecordType extends Record<string, any> = any> extend
35
35
  id?: string;
36
36
  indentSize?: number;
37
37
  loading?: boolean;
38
- pagination?: Pagination;
38
+ pagination?: TablePagination;
39
39
  prefixCls?: string;
40
40
  renderGroupSection?: RenderGroupSection;
41
41
  renderPagination?: RenderPagination;
@@ -225,6 +225,7 @@ export declare type Size = ArrayElement<typeof strings.SIZES>;
225
225
  export declare type Title<RecordType> = React.ReactNode | ((pageData?: RecordType[]) => React.ReactNode);
226
226
  export declare type PaginationPosition = ArrayElement<typeof strings.PAGINATION_POSITIONS>;
227
227
  export declare type Pagination = TablePaginationProps | boolean;
228
+ export declare type TablePagination = Pagination;
228
229
  export interface ChangeInfoFilter<RecordType> extends BaseChangeInfoFilter<RecordType> {
229
230
  filters?: Filter[];
230
231
  onFilter?: OnFilter<RecordType>;
@@ -34,7 +34,7 @@ declare class TabBar extends React.Component<TabBarProps, TabBarState> {
34
34
  renderTabComponents: (list: Array<PlainTab>) => Array<ReactNode>;
35
35
  handleArrowClick: (items: Array<OverflowItem>, pos: 'start' | 'end') => void;
36
36
  renderCollapse: (items: Array<OverflowItem>, icon: ReactNode, pos: 'start' | 'end') => ReactNode;
37
- renderOverflow: (items: [Array<OverflowItem>, Array<OverflowItem>]) => Array<ReactNode>;
37
+ renderOverflow: (items: any[]) => Array<ReactNode>;
38
38
  renderCollapsedTab: () => ReactNode;
39
39
  render(): ReactNode;
40
40
  private _isActive;
@@ -4,7 +4,7 @@ import TabsFoundation, { TabsAdapter } from '@douyinfe/semi-foundation/lib/es/ta
4
4
  import BaseComponent from '../_base/baseComponent';
5
5
  import '@douyinfe/semi-foundation/lib/es/tabs/tabs.css';
6
6
  import TabPane from './TabPane';
7
- import { PlainTab, TabsProps } from './interface';
7
+ import { TabsProps, PlainTab } from './interface';
8
8
  export * from './interface';
9
9
  export interface TabsState {
10
10
  activeKey: string;
@@ -20,7 +20,7 @@ var __rest = this && this.__rest || function (s, e) {
20
20
  return t;
21
21
  };
22
22
 
23
- import React, { createRef } from 'react';
23
+ import React, { createRef, isValidElement } from 'react';
24
24
  import cls from 'classnames';
25
25
  import PropTypes from 'prop-types';
26
26
  import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/tabs/constants';
@@ -80,7 +80,7 @@ class Tabs extends BaseComponent {
80
80
  }
81
81
 
82
82
  return _filterInstanceProperty(_context = React.Children.toArray(children)).call(_context, pane => {
83
- if (pane && pane.type && pane.type.isTabPane) {
83
+ if ( /*#__PURE__*/isValidElement(pane) && pane.type && pane.type.isTabPane) {
84
84
  return pane.props.itemKey === activeKey;
85
85
  }
86
86
 
@@ -218,7 +218,7 @@ class Tabs extends BaseComponent {
218
218
  children
219
219
  } = this.props;
220
220
  let activeKey = '';
221
- const list = tabList ? tabList : _mapInstanceProperty(_context4 = React.Children.toArray(children)).call(_context4, child => child.props);
221
+ const list = tabList ? tabList : _mapInstanceProperty(_context4 = React.Children.toArray(children)).call(_context4, child => /*#__PURE__*/isValidElement(child) ? child.props : null);
222
222
 
223
223
  _forEachInstanceProperty(list).call(list, item => {
224
224
  if (item && !activeKey && !item.disabled) {
@@ -248,9 +248,9 @@ class Tabs extends BaseComponent {
248
248
  var _context5, _context6;
249
249
 
250
250
  // Panes state acts on tab bar, no need to compare TabPane children
251
- const prevChildrenProps = _mapInstanceProperty(_context5 = React.Children.toArray(prevProps.children)).call(_context5, child => pick(child.props, panePickKeys));
251
+ const prevChildrenProps = _mapInstanceProperty(_context5 = React.Children.toArray(prevProps.children)).call(_context5, child => pick( /*#__PURE__*/isValidElement(child) ? child.props : null, panePickKeys));
252
252
 
253
- const nowChildrenProps = _mapInstanceProperty(_context6 = React.Children.toArray(this.props.children)).call(_context6, child => pick(child.props, panePickKeys));
253
+ const nowChildrenProps = _mapInstanceProperty(_context6 = React.Children.toArray(this.props.children)).call(_context6, child => pick( /*#__PURE__*/isValidElement(child) ? child.props : null, panePickKeys));
254
254
 
255
255
  const isTabListType = this.props.tabList || prevProps.tabList;
256
256
 
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import BaseComponent, { BaseProps } from '../_base/baseComponent';
3
3
  import ScrollItem from '../scrollList/scrollItem';
4
- import ComboboxFoundation from '@douyinfe/semi-foundation/lib/es/timePicker/ComboxFoundation';
4
+ import ComboboxFoundation, { formatOption } from '@douyinfe/semi-foundation/lib/es/timePicker/ComboxFoundation';
5
5
  import { TimePickerProps } from './TimePicker';
6
6
  import { Locale } from '../locale/interface';
7
7
  export declare type ComboboxProps = Pick<TimePickerProps, 'format' | 'prefixCls' | 'disabledHours' | 'disabledMinutes' | 'disabledSeconds' | 'hideDisabledOptions' | 'use12Hours' | 'scrollItemProps' | 'panelFooter' | 'panelHeader'> & BaseProps & {
@@ -26,6 +26,11 @@ export interface ComboboxState {
26
26
  minuteOptions: number[];
27
27
  secondOptions: number[];
28
28
  }
29
+ export declare type FormatOptionReturn = ReturnType<typeof formatOption>;
30
+ export interface AMPMOptionItem {
31
+ value: string;
32
+ text: string;
33
+ }
29
34
  declare class Combobox extends BaseComponent<ComboboxProps, ComboboxState> {
30
35
  static propTypes: {
31
36
  format: PropTypes.Requireable<string>;
@@ -56,11 +61,12 @@ declare class Combobox extends BaseComponent<ComboboxProps, ComboboxState> {
56
61
  componentDidUpdate(prevProps: ComboboxProps, prevState: ComboboxState): void;
57
62
  componentWillUnmount(): void;
58
63
  componentDidMount(): void;
59
- cacheRefCurrent: (key: string, current: ScrollItem) => void;
64
+ cacheRefCurrent: (key: string, current: ScrollItem<FormatOptionReturn> | ScrollItem<AMPMOptionItem>) => void;
60
65
  reselect: () => void;
61
- onItemChange: ({ type, value }: {
62
- type: string;
66
+ onItemChange: ({ type, value, disabled }: {
67
+ type?: string;
63
68
  value: string;
69
+ disabled?: boolean;
64
70
  }) => void;
65
71
  onEnterSelectPanel: (range: string) => void;
66
72
  renderHourSelect(hour: number, locale: Locale['TimePicker']): JSX.Element;
@@ -44,7 +44,8 @@ class Combobox extends BaseComponent {
44
44
  this.onItemChange = _ref => {
45
45
  let {
46
46
  type,
47
- value
47
+ value,
48
+ disabled
48
49
  } = _ref;
49
50
  // eslint-disable-next-line prefer-const
50
51
  let {
@@ -49,7 +49,7 @@ export declare type TimePickerProps = {
49
49
  position?: Position;
50
50
  prefixCls?: string;
51
51
  rangeSeparator?: string;
52
- scrollItemProps?: ScrollItemProps;
52
+ scrollItemProps?: ScrollItemProps<any>;
53
53
  secondStep?: number;
54
54
  showClear?: boolean;
55
55
  size?: InputSize;
@@ -4,7 +4,7 @@ import { ToastListAdapter, ToastListProps, ToastListState } from '@douyinfe/semi
4
4
  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
- import { Motion } from '_base/base';
7
+ import { Motion } from '../_base/base';
8
8
  export { ToastTransitionProps } from './ToastTransition';
9
9
  export interface ToastReactProps extends ToastProps {
10
10
  style?: CSSProperties;
@@ -952,7 +952,8 @@ class TreeSelect extends BaseComponent {
952
952
  registerClickOutsideHandler: cb => {
953
953
  const clickOutsideHandler = e => {
954
954
  const optionInstance = this.optionsRef && this.optionsRef.current;
955
- const triggerDom = this.triggerRef && this.triggerRef.current;
955
+ const triggerDom = this.triggerRef && this.triggerRef.current; // eslint-disable-next-line
956
+
956
957
  const optionsDom = ReactDOM.findDOMNode(optionInstance);
957
958
  const target = e.target;
958
959
 
@@ -63,7 +63,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
63
63
  link: PropTypes.Requireable<boolean | object>;
64
64
  spacing: PropTypes.Requireable<"normal" | "extended">;
65
65
  strong: PropTypes.Requireable<boolean>;
66
- size: PropTypes.Requireable<"normal" | "small">;
66
+ size: PropTypes.Requireable<"small" | "normal">;
67
67
  type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
68
68
  style: PropTypes.Requireable<object>;
69
69
  className: PropTypes.Requireable<string>;
@@ -30,7 +30,7 @@ export default class Paragraph extends PureComponent<ParagraphProps> {
30
30
  underline: PropTypes.Requireable<boolean>;
31
31
  strong: PropTypes.Requireable<boolean>;
32
32
  type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
33
- size: PropTypes.Requireable<"normal" | "small">;
33
+ size: PropTypes.Requireable<"small" | "normal">;
34
34
  spacing: PropTypes.Requireable<"normal" | "extended">;
35
35
  style: PropTypes.Requireable<object>;
36
36
  className: PropTypes.Requireable<string>;
@@ -33,7 +33,7 @@ export default class Text extends PureComponent<TextProps> {
33
33
  link: PropTypes.Requireable<boolean | object>;
34
34
  strong: PropTypes.Requireable<boolean>;
35
35
  type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
36
- size: PropTypes.Requireable<"normal" | "small">;
36
+ size: PropTypes.Requireable<"small" | "normal">;
37
37
  style: PropTypes.Requireable<object>;
38
38
  className: PropTypes.Requireable<string>;
39
39
  code: PropTypes.Requireable<boolean>;
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
37
37
  underline: PropTypes.Requireable<boolean>;
38
38
  strong: PropTypes.Requireable<boolean>;
39
39
  type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
40
- heading: PropTypes.Requireable<4 | 2 | 1 | 3 | 5 | 6>;
40
+ heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 5 | 6>;
41
41
  style: PropTypes.Requireable<object>;
42
42
  className: PropTypes.Requireable<string>;
43
43
  component: PropTypes.Requireable<string>;
@@ -1,25 +1,10 @@
1
- import { PureComponent, ReactNode, MouseEventHandler, MouseEvent, CSSProperties } from 'react';
1
+ import { PureComponent, ReactNode, MouseEvent, CSSProperties } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Locale } from '../locale/interface';
4
- export interface FileCardProps {
4
+ import { RenderFileItemProps } from './interface';
5
+ export interface FileCardProps extends RenderFileItemProps {
5
6
  className?: string;
6
- disabled?: boolean;
7
- listType?: 'picture' | 'list';
8
- name?: string;
9
- onPreviewClick?: MouseEventHandler<HTMLDivElement>;
10
- onRemove?: (props: FileCardProps, e: MouseEvent) => void;
11
- onReplace?: (props: FileCardProps, e: MouseEvent) => void;
12
- onRetry?: (props: FileCardProps, e: MouseEvent) => void;
13
- percent?: number;
14
- preview?: boolean;
15
- previewFile?: (props: FileCardProps) => ReactNode;
16
- showReplace?: boolean;
17
- showRetry?: boolean;
18
- size?: string;
19
- status?: string;
20
7
  style?: CSSProperties;
21
- url?: string;
22
- validateMessage?: ReactNode;
23
8
  }
24
9
  declare class FileCard extends PureComponent<FileCardProps> {
25
10
  static propTypes: {
@@ -1,65 +1,12 @@
1
1
  import { ReactNode, CSSProperties, RefObject, ChangeEvent, DragEvent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import UploadFoundation, { BaseFileItem, UploadAdapter, BeforeUploadObjectResult, AfterUploadResult } from '@douyinfe/semi-foundation/lib/es/upload/foundation';
4
- import { strings } from '@douyinfe/semi-foundation/lib/es/upload/constants';
3
+ import UploadFoundation, { UploadAdapter, BeforeUploadObjectResult, AfterUploadResult } from '@douyinfe/semi-foundation/lib/es/upload/foundation';
5
4
  import FileCard from './fileCard';
6
5
  import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
7
- import { ArrayElement } from '../_base/base';
6
+ import { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError } from './interface';
8
7
  import { Locale } from '../locale/interface';
9
8
  import '@douyinfe/semi-foundation/lib/es/upload/upload.css';
10
- export { BeforeUploadObjectResult, AfterUploadResult };
11
- export interface FileItem extends BaseFileItem {
12
- validateMessage?: ReactNode;
13
- }
14
- export declare type UploadListType = ArrayElement<typeof strings.LIST_TYPE>;
15
- export declare type PromptPositionType = ArrayElement<typeof strings.PROMPT_POSITION>;
16
- export interface RenderFileItemProps extends FileItem {
17
- previewFile: (fileItem: FileItem) => ReactNode;
18
- listType: UploadListType;
19
- onRemove: () => void;
20
- onRetry: () => void;
21
- onReplace: () => void;
22
- key: string;
23
- showRetry: boolean;
24
- showReplace: boolean;
25
- style: CSSProperties;
26
- disabled: boolean;
27
- onPreviewClick: () => void;
28
- }
29
- export interface BeforeUploadProps {
30
- file: FileItem;
31
- fileList: Array<FileItem>;
32
- }
33
- export interface AfterUploadProps {
34
- file: FileItem;
35
- fileList: Array<FileItem>;
36
- response: any;
37
- }
38
- export interface OnChangeProps {
39
- fileList: Array<FileItem>;
40
- currentFile: FileItem;
41
- }
42
- export interface customRequestArgs {
43
- fileName: string;
44
- data: Record<string, any>;
45
- file: FileItem;
46
- fileInstance: File;
47
- onProgress: (event: {
48
- total: number;
49
- loaded: number;
50
- }) => any;
51
- onError: (userXhr: {
52
- status?: number;
53
- }, e: Event) => any;
54
- onSuccess: (response: any, e: Event) => any;
55
- withCredentials: boolean;
56
- action: string;
57
- }
58
- export interface CustomError extends Error {
59
- status: number;
60
- method: string;
61
- url: string;
62
- }
9
+ export { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError, BeforeUploadObjectResult, AfterUploadResult };
63
10
  export interface UploadProps {
64
11
  accept?: string;
65
12
  action: string;
@@ -103,7 +50,7 @@ export interface UploadProps {
103
50
  onRetry?: (fileItem: FileItem) => void;
104
51
  onSizeError?: (file: File, fileList: Array<FileItem>) => void;
105
52
  onSuccess?: (responseBody: any, file: File, fileList: Array<FileItem>) => void;
106
- previewFile?: (fileItem: FileItem) => ReactNode;
53
+ previewFile?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
107
54
  prompt?: ReactNode;
108
55
  promptPosition?: PromptPositionType;
109
56
  renderFileItem?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
@@ -0,0 +1,56 @@
1
+ import { ReactNode, CSSProperties, MouseEvent } from 'react';
2
+ import { BaseFileItem } from '@douyinfe/semi-foundation/lib/es/upload/foundation';
3
+ import { strings } from '@douyinfe/semi-foundation/lib/es/upload/constants';
4
+ import { ArrayElement } from '../_base/base';
5
+ export declare type PromptPositionType = ArrayElement<typeof strings.PROMPT_POSITION>;
6
+ export declare type UploadListType = ArrayElement<typeof strings.LIST_TYPE>;
7
+ export interface BeforeUploadProps {
8
+ file: FileItem;
9
+ fileList: Array<FileItem>;
10
+ }
11
+ export interface AfterUploadProps {
12
+ file: FileItem;
13
+ fileList: Array<FileItem>;
14
+ response: any;
15
+ }
16
+ export interface OnChangeProps {
17
+ fileList: Array<FileItem>;
18
+ currentFile: FileItem;
19
+ }
20
+ export interface customRequestArgs {
21
+ fileName: string;
22
+ data: Record<string, any>;
23
+ file: FileItem;
24
+ fileInstance: File;
25
+ onProgress: (event: {
26
+ total: number;
27
+ loaded: number;
28
+ }) => any;
29
+ onError: (userXhr: {
30
+ status?: number;
31
+ }, e: Event) => any;
32
+ onSuccess: (response: any, e: Event) => any;
33
+ withCredentials: boolean;
34
+ action: string;
35
+ }
36
+ export interface CustomError extends Error {
37
+ status: number;
38
+ method: string;
39
+ url: string;
40
+ }
41
+ export interface FileItem extends BaseFileItem {
42
+ validateMessage?: ReactNode;
43
+ }
44
+ export interface RenderFileItemProps extends FileItem {
45
+ previewFile?: (fileItem: RenderFileItemProps) => ReactNode;
46
+ listType: UploadListType;
47
+ onRemove: (props: RenderFileItemProps, e: MouseEvent) => void;
48
+ onRetry: (props: RenderFileItemProps, e: MouseEvent) => void;
49
+ onReplace: (props: RenderFileItemProps, e: MouseEvent) => void;
50
+ key: string;
51
+ showRetry: boolean;
52
+ showReplace: boolean;
53
+ style?: CSSProperties;
54
+ disabled: boolean;
55
+ onPreviewClick: () => void;
56
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.1.0-beta.1",
3
+ "version": "2.1.0",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",
@@ -19,11 +19,12 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@babel/runtime-corejs3": "^7.15.4",
22
- "@douyinfe/semi-animation-react": "2.1.0-beta.1",
23
- "@douyinfe/semi-foundation": "2.1.0-beta.1",
24
- "@douyinfe/semi-icons": "2.1.0-beta.1",
25
- "@douyinfe/semi-illustrations": "2.1.0-beta.1",
26
- "@douyinfe/semi-theme-default": "2.1.0-beta.1",
22
+ "@douyinfe/semi-animation-react": "2.1.0",
23
+ "@douyinfe/semi-foundation": "2.1.0",
24
+ "@douyinfe/semi-icons": "2.1.0",
25
+ "@douyinfe/semi-illustrations": "2.1.0",
26
+ "@douyinfe/semi-theme-default": "2.1.0",
27
+ "@types/react-window": "^1.8.2",
27
28
  "async-validator": "^3.5.0",
28
29
  "classnames": "^2.2.6",
29
30
  "copy-text-to-clipboard": "^2.1.1",
@@ -64,13 +65,13 @@
64
65
  ],
65
66
  "author": "",
66
67
  "license": "MIT",
67
- "gitHead": "112ef9a681542c2057f98e2e708648b4fdd5618c",
68
+ "gitHead": "337c5b02a791cf46483e0273c8dc842a9eab222f",
68
69
  "devDependencies": {
69
70
  "@babel/plugin-proposal-decorators": "^7.15.8",
70
71
  "@babel/plugin-transform-runtime": "^7.15.8",
71
72
  "@babel/preset-env": "^7.15.8",
72
73
  "@babel/preset-react": "^7.14.5",
73
- "@douyinfe/semi-scss-compile": "2.1.0-beta.1",
74
+ "@douyinfe/semi-scss-compile": "2.1.0",
74
75
  "@storybook/addon-knobs": "^6.3.1",
75
76
  "babel-loader": "^8.2.2",
76
77
  "case-sensitive-paths-webpack-plugin": "^2.4.0",