@douyinfe/semi-ui 2.0.8 → 2.0.9-alpha.4

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 (60) hide show
  1. package/dist/css/semi.css +153 -5
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +759 -652
  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 -12
  8. package/lib/es/autoComplete/index.js +0 -1
  9. package/lib/es/calendar/dayCalendar.js +1 -1
  10. package/lib/es/calendar/monthCalendar.js +1 -1
  11. package/lib/es/calendar/rangeCalendar.js +1 -1
  12. package/lib/es/calendar/weekCalendar.js +1 -1
  13. package/lib/es/collapse/index.js +1 -5
  14. package/lib/es/datePicker/index.d.ts +1 -1
  15. package/lib/es/datePicker/yearAndMonth.d.ts +2 -2
  16. package/lib/es/form/baseForm.d.ts +1 -1
  17. package/lib/es/form/baseForm.js +1 -2
  18. package/lib/es/form/field.d.ts +1 -1
  19. package/lib/es/form/hoc/withField.d.ts +2 -2
  20. package/lib/es/form/hoc/withField.js +5 -1
  21. package/lib/es/form/interface.d.ts +2 -2
  22. package/lib/es/locale/localeConsumer.d.ts +5 -5
  23. package/lib/es/modal/useModal/HookModal.d.ts +3 -2
  24. package/lib/es/modal/useModal/index.js +1 -1
  25. package/lib/es/navigation/index.d.ts +1 -1
  26. package/lib/es/notification/index.d.ts +2 -2
  27. package/lib/es/notification/index.js +1 -1
  28. package/lib/es/rating/index.d.ts +1 -1
  29. package/lib/es/resizeObserver/index.js +1 -0
  30. package/lib/es/scrollList/scrollItem.d.ts +12 -11
  31. package/lib/es/scrollList/scrollItem.js +8 -8
  32. package/lib/es/select/index.d.ts +0 -1
  33. package/lib/es/select/index.js +2 -3
  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/slider/index.js +3 -1
  39. package/lib/es/spin/index.d.ts +2 -2
  40. package/lib/es/spin/index.js +1 -1
  41. package/lib/es/steps/basicSteps.js +2 -2
  42. package/lib/es/steps/fillSteps.js +3 -3
  43. package/lib/es/steps/navSteps.js +2 -2
  44. package/lib/es/table/interface.d.ts +2 -1
  45. package/lib/es/tabs/TabBar.d.ts +1 -1
  46. package/lib/es/tabs/index.js +5 -5
  47. package/lib/es/timePicker/Combobox.d.ts +10 -4
  48. package/lib/es/timePicker/Combobox.js +2 -1
  49. package/lib/es/timePicker/TimePicker.d.ts +1 -1
  50. package/lib/es/toast/index.d.ts +2 -2
  51. package/lib/es/treeSelect/index.js +2 -1
  52. package/lib/es/typography/base.d.ts +1 -1
  53. package/lib/es/typography/paragraph.d.ts +1 -1
  54. package/lib/es/typography/text.d.ts +1 -1
  55. package/lib/es/typography/title.d.ts +1 -1
  56. package/lib/es/upload/fileCard.d.ts +3 -18
  57. package/lib/es/upload/index.d.ts +4 -56
  58. package/lib/es/upload/interface.d.ts +56 -0
  59. package/lib/es/upload/interface.js +1 -0
  60. package/package.json +6 -5
@@ -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>;
@@ -32,7 +32,7 @@ declare class TabBar extends React.Component<TabBarProps, TabBarState> {
32
32
  renderTabComponents: (list: Array<PlainTab>) => Array<ReactNode>;
33
33
  handleArrowClick: (items: Array<OverflowItem>, pos: 'start' | 'end') => void;
34
34
  renderCollapse: (items: Array<OverflowItem>, icon: ReactNode, pos: 'start' | 'end') => ReactNode;
35
- renderOverflow: (items: [Array<OverflowItem>, Array<OverflowItem>]) => Array<ReactNode>;
35
+ renderOverflow: (items: any[]) => Array<ReactNode>;
36
36
  renderCollapsedTab: () => ReactNode;
37
37
  render(): ReactNode;
38
38
  private _isActive;
@@ -19,7 +19,7 @@ var __rest = this && this.__rest || function (s, e) {
19
19
  return t;
20
20
  };
21
21
 
22
- import React, { createRef } from 'react';
22
+ import React, { createRef, isValidElement } from 'react';
23
23
  import cls from 'classnames';
24
24
  import PropTypes from 'prop-types';
25
25
  import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/tabs/constants';
@@ -79,7 +79,7 @@ class Tabs extends BaseComponent {
79
79
  }
80
80
 
81
81
  return _filterInstanceProperty(_context = React.Children.toArray(children)).call(_context, pane => {
82
- if (pane && pane.type && pane.type.isTabPane) {
82
+ if ( /*#__PURE__*/isValidElement(pane) && pane.type && pane.type.isTabPane) {
83
83
  return pane.props.itemKey === activeKey;
84
84
  }
85
85
 
@@ -155,7 +155,7 @@ class Tabs extends BaseComponent {
155
155
  children
156
156
  } = this.props;
157
157
  let activeKey = '';
158
- const list = tabList ? tabList : _mapInstanceProperty(_context3 = React.Children.toArray(children)).call(_context3, child => child.props);
158
+ const list = tabList ? tabList : _mapInstanceProperty(_context3 = React.Children.toArray(children)).call(_context3, child => /*#__PURE__*/isValidElement(child) ? child.props : null);
159
159
 
160
160
  _forEachInstanceProperty(list).call(list, item => {
161
161
  if (item && !activeKey && !item.disabled) {
@@ -182,9 +182,9 @@ class Tabs extends BaseComponent {
182
182
  var _context4, _context5;
183
183
 
184
184
  // Panes state acts on tab bar, no need to compare TabPane children
185
- const prevChildrenProps = _mapInstanceProperty(_context4 = React.Children.toArray(prevProps.children)).call(_context4, child => pick(child.props, panePickKeys));
185
+ const prevChildrenProps = _mapInstanceProperty(_context4 = React.Children.toArray(prevProps.children)).call(_context4, child => pick( /*#__PURE__*/isValidElement(child) ? child.props : null, panePickKeys));
186
186
 
187
- const nowChildrenProps = _mapInstanceProperty(_context5 = React.Children.toArray(this.props.children)).call(_context5, child => pick(child.props, panePickKeys));
187
+ const nowChildrenProps = _mapInstanceProperty(_context5 = React.Children.toArray(this.props.children)).call(_context5, child => pick( /*#__PURE__*/isValidElement(child) ? child.props : null, panePickKeys));
188
188
 
189
189
  const isTabListType = this.props.tabList || prevProps.tabList;
190
190
 
@@ -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,14 +4,14 @@ 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;
11
11
  icon?: React.ReactNode;
12
12
  content: React.ReactNode;
13
13
  }
14
- export { ToastListProps, ToastListState, ToastState };
14
+ export { ConfigProps, ToastListProps, ToastListState, ToastState };
15
15
  declare const createBaseToast: () => {
16
16
  new (props: ToastListProps): {
17
17
  readonly adapter: ToastListAdapter;
@@ -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,64 +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 interface FileItem extends BaseFileItem {
11
- validateMessage?: ReactNode;
12
- }
13
- export declare type UploadListType = ArrayElement<typeof strings.LIST_TYPE>;
14
- export declare type PromptPositionType = ArrayElement<typeof strings.PROMPT_POSITION>;
15
- export interface RenderFileItemProps extends FileItem {
16
- previewFile: (fileItem: FileItem) => ReactNode;
17
- listType: UploadListType;
18
- onRemove: () => void;
19
- onRetry: () => void;
20
- onReplace: () => void;
21
- key: string;
22
- showRetry: boolean;
23
- showReplace: boolean;
24
- style: CSSProperties;
25
- disabled: boolean;
26
- onPreviewClick: () => void;
27
- }
28
- export interface BeforeUploadProps {
29
- file: FileItem;
30
- fileList: Array<FileItem>;
31
- }
32
- export interface AfterUploadProps {
33
- file: FileItem;
34
- fileList: Array<FileItem>;
35
- response: any;
36
- }
37
- export interface OnChangeProps {
38
- fileList: Array<FileItem>;
39
- currentFile: FileItem;
40
- }
41
- export interface customRequestArgs {
42
- fileName: string;
43
- data: Record<string, any>;
44
- file: FileItem;
45
- fileInstance: File;
46
- onProgress: (event: {
47
- total: number;
48
- loaded: number;
49
- }) => any;
50
- onError: (userXhr: {
51
- status?: number;
52
- }, e: Event) => any;
53
- onSuccess: (response: any, e: Event) => any;
54
- withCredentials: boolean;
55
- action: string;
56
- }
57
- export interface CustomError extends Error {
58
- status: number;
59
- method: string;
60
- url: string;
61
- }
9
+ export { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError };
62
10
  export interface UploadProps {
63
11
  accept?: string;
64
12
  action: string;
@@ -102,7 +50,7 @@ export interface UploadProps {
102
50
  onRetry?: (fileItem: FileItem) => void;
103
51
  onSizeError?: (file: File, fileList: Array<FileItem>) => void;
104
52
  onSuccess?: (responseBody: any, file: File, fileList: Array<FileItem>) => void;
105
- previewFile?: (fileItem: FileItem) => ReactNode;
53
+ previewFile?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
106
54
  prompt?: ReactNode;
107
55
  promptPosition?: PromptPositionType;
108
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.0.8",
3
+ "version": "2.0.9-alpha.4",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",
@@ -20,10 +20,11 @@
20
20
  "dependencies": {
21
21
  "@babel/runtime-corejs3": "^7.15.4",
22
22
  "@douyinfe/semi-animation-react": "2.0.8",
23
- "@douyinfe/semi-foundation": "2.0.8",
24
- "@douyinfe/semi-icons": "2.0.8",
25
- "@douyinfe/semi-illustrations": "2.0.8",
23
+ "@douyinfe/semi-foundation": "2.0.9-alpha.3",
24
+ "@douyinfe/semi-icons": "2.0.9-alpha.3",
25
+ "@douyinfe/semi-illustrations": "2.0.9-alpha.0",
26
26
  "@douyinfe/semi-theme-default": "2.0.8",
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,7 +65,7 @@
64
65
  ],
65
66
  "author": "",
66
67
  "license": "MIT",
67
- "gitHead": "0a2a5df053d415ee634ae3c5b8aa24915aa2cf9b",
68
+ "gitHead": "aea759b0e8ce303ec7bcab52ea8950da257f611a",
68
69
  "devDependencies": {
69
70
  "@babel/plugin-proposal-decorators": "^7.15.8",
70
71
  "@babel/plugin-transform-runtime": "^7.15.8",