瀏覽代碼

fix: [tagGroup] Move the inteface declaration to inteface.ts (#1097)

YyumeiZhang 3 年之前
父節點
當前提交
c2c89f9f46
共有 2 個文件被更改,包括 18 次插入16 次删除
  1. 2 16
      packages/semi-ui/tag/group.tsx
  2. 16 0
      packages/semi-ui/tag/interface.ts

+ 2 - 16
packages/semi-ui/tag/group.tsx

@@ -3,27 +3,13 @@ import classNames from 'classnames';
 import PropTypes from 'prop-types';
 import PropTypes from 'prop-types';
 import { cssClasses, strings } from '@douyinfe/semi-foundation/tag/constants';
 import { cssClasses, strings } from '@douyinfe/semi-foundation/tag/constants';
 import Tag from './index';
 import Tag from './index';
-import Popover, { PopoverProps } from '../popover/index';
-import { AvatarShape, TagProps } from './interface';
+import Popover from '../popover/index';
+import { AvatarShape, TagProps, TagGroupProps } from './interface';
 
 
 const prefixCls = cssClasses.PREFIX;
 const prefixCls = cssClasses.PREFIX;
 const tagSize = strings.TAG_SIZE;
 const tagSize = strings.TAG_SIZE;
 const avatarShapeSet = strings.AVATAR_SHAPE;
 const avatarShapeSet = strings.AVATAR_SHAPE;
 
 
-export interface TagGroupProps<T> {
-    style?: React.CSSProperties;
-    className?: string;
-    maxTagCount?: number;
-    restCount?: number;
-    tagList?: (T extends 'custom' ? React.ReactNode : TagProps)[];
-    size?: 'small' | 'large';
-    showPopover?: boolean;
-    popoverProps?: PopoverProps;
-    avatarShape?: AvatarShape;
-    mode?: string;
-    onTagClose: (tagChildren: React.ReactNode, event: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
-}
-
 export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
 export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
     static defaultProps = {
     static defaultProps = {
         style: {},
         style: {},

+ 16 - 0
packages/semi-ui/tag/interface.ts

@@ -1,3 +1,5 @@
+import { PopoverProps } from '../popover/index';
+
 export type TagColor =
 export type TagColor =
     | 'amber'
     | 'amber'
     | 'blue'
     | 'blue'
@@ -38,3 +40,17 @@ export interface TagProps {
     'aria-label'?: React.AriaAttributes['aria-label'];
     'aria-label'?: React.AriaAttributes['aria-label'];
     tabIndex?: number; // use internal, when tag in taInput, we want to use left arrow and right arrow to control the tag focus, so the tabIndex need to be -1. 
     tabIndex?: number; // use internal, when tag in taInput, we want to use left arrow and right arrow to control the tag focus, so the tabIndex need to be -1. 
 }
 }
+
+export interface TagGroupProps<T> {
+    style?: React.CSSProperties;
+    className?: string;
+    maxTagCount?: number;
+    restCount?: number;
+    tagList?: (T extends 'custom' ? React.ReactNode : TagProps)[];
+    size?: 'small' | 'large';
+    showPopover?: boolean;
+    popoverProps?: PopoverProps;
+    avatarShape?: AvatarShape;
+    mode?: string;
+    onTagClose: (tagChildren: React.ReactNode, event: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
+}