Просмотр исходного кода

fix: [Tabs]remove useless notify func and code lint

yanqi.xu 4 лет назад
Родитель
Сommit
9698746e16

+ 0 - 1
packages/semi-foundation/tabs/foundation.ts

@@ -7,7 +7,6 @@ export interface TabsAdapter<P = Record<string, any>, S = Record<string, any>> e
     notifyTabClick: (activeKey: string, event: any) => void;
     notifyChange: (activeKey: string) => void;
     setNewActiveKey: (activeKey: string) => void;
-    notifyPanesUpdate: (panes: Array<any>) => void;
     getDefaultActiveKeyFromChildren: () => string;
     notifyTabDelete: (tabKey: string) => void;
 }

+ 2 - 2
packages/semi-ui/tabs/TabBar.tsx

@@ -91,7 +91,7 @@ class TabBar extends React.Component<TabBarProps, TabBarState> {
     renderTabItem = (panel: PlainTab): ReactNode => {
         const { size, type, deleteTabItem } = this.props;
         const panelIcon = panel.icon ? this.renderIcon(panel.icon) : null;
-        const closableIcon = (type === 'card' && panel.closable) ? <IconClose className={`${cssClasses.TABS_TAB}-icon-close`} onClick={(e: React.MouseEvent<HTMLSpanElement>) => deleteTabItem(panel.itemKey, e)}/> : null
+        const closableIcon = (type === 'card' && panel.closable) ? <IconClose className={`${cssClasses.TABS_TAB}-icon-close`} onClick={(e: React.MouseEvent<HTMLSpanElement>) => deleteTabItem(panel.itemKey, e)} /> : null
         let events = {};
         const key = panel.itemKey;
         if (!panel.disabled) {
@@ -195,7 +195,7 @@ class TabBar extends React.Component<TabBarProps, TabBarState> {
     };
 
     renderOverflow = (items: [Array<OverflowItem>, Array<OverflowItem>]): Array<ReactNode> => items.map((item, ind) => {
-        const icon = ind === 0 ? <IconChevronLeft/> : <IconChevronRight/>;
+        const icon = ind === 0 ? <IconChevronLeft /> : <IconChevronRight />;
         const pos = ind === 0 ? 'start' : 'end';
         return this.renderCollapse(item, icon, pos);
     });

+ 2 - 5
packages/semi-ui/tabs/index.tsx

@@ -101,7 +101,7 @@ class Tabs extends BaseComponent<TabsProps, TabsState> {
             collectActiveKey: (): void => {
                 let panes = [];
                 const { tabList, children, activeKey: propsActiveKey } = this.props;
-                if(typeof propsActiveKey !== 'undefined'){
+                if (typeof propsActiveKey !== 'undefined') {
                     return;
                 }
                 const { activeKey } = this.state;
@@ -134,9 +134,6 @@ class Tabs extends BaseComponent<TabsProps, TabsState> {
             setNewActiveKey: (activeKey: string): void => {
                 this.setState({ activeKey });
             },
-            notifyPanesUpdate: (panes: Array<PlainTab>): void => {
-                this.setState({ panes });
-            },
             getDefaultActiveKeyFromChildren: (): string => {
                 const { tabList, children } = this.props;
                 let activeKey = '';
@@ -223,7 +220,7 @@ class Tabs extends BaseComponent<TabsProps, TabsState> {
 
     deleteTabItem = (tabKey: string, event: MouseEvent<HTMLDivElement>) => {
         event.stopPropagation();
-        this.foundation.handleTabDelete(tabKey)
+        this.foundation.handleTabDelete(tabKey);
     }
 
     render(): ReactNode {