Skip to content

Commit

Permalink
chore(SplitButton): fix ts problems
Browse files Browse the repository at this point in the history
  • Loading branch information
mario.gk committed Mar 22, 2024
1 parent b606687 commit 9019167
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 9 deletions.
2 changes: 0 additions & 2 deletions components/split-button/__docs__/adaptor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-use-before-define */
import React from 'react';
import { SplitButton, Menu, Icon } from '@alifd/next';
import { Types, parseData, ContentType } from '@alifd/adaptor-helper';
Expand Down Expand Up @@ -30,7 +29,6 @@ const createDataSouce = (

list.forEach(item => {
switch (item.type) {
// eslint-disable-next-line no-case-declarations
case 'node':
key = `${prefix || level}-${index++}`;
if (item.children && item.children.length > 0) {
Expand Down
1 change: 0 additions & 1 deletion components/split-button/__docs__/theme/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import ConfigProvider from '../../../config-provider';
import '../../../demo-helper/style';
import '../../style';

/* eslint-disable */
const i18nMap = {
'zh-cn': {
splitButton: '分隔下拉按钮',
Expand Down
4 changes: 2 additions & 2 deletions components/split-button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class SplitButton extends React.Component<SplitButtonProps> {
this.props.onSelect && this.props.onSelect(keys, ...others);
};

clickMenuItem = (key: string, ...others: [MenuItem, React.MouseEvent]) => {
clickMenuItem: MenuProps['onItemClick'] = (key, ...others) => {
this.props.onItemClick && this.props.onItemClick(key, ...others);
this.onVisibleChange(false, 'menuSelect');
};
Expand All @@ -117,7 +117,7 @@ class SplitButton extends React.Component<SplitButtonProps> {
}
};

onVisibleChange = (visible: boolean, reason: 'menuSelect' | 'fromTrigger' | 'docClick') => {
onVisibleChange: NonNullable<SplitButtonProps['onVisibleChange']> = (visible, reason) => {
if (!('visible' in this.props)) {
this.setState({
visible,
Expand Down
4 changes: 0 additions & 4 deletions components/split-button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ export interface SplitButtonProps extends Omit<ButtonProps, 'onSelect'>, CommonP
/**
* 设置标签类型
* @en The html tag to be rendered
* @defaultValue 'button'
*/
component?: 'button' | 'a';

/**
* 是否为幽灵按钮
* @en Setting ghost button
* @defaultValue false
*/
ghost?: 'light' | 'dark' | false | true;

Expand All @@ -63,7 +61,6 @@ export interface SplitButtonProps extends Omit<ButtonProps, 'onSelect'>, CommonP
/**
* 菜单的选择模式
* @en The select mode of menu
* @defaultValue 'single'
*/
selectMode?: 'single' | 'multiple';

Expand Down Expand Up @@ -122,7 +119,6 @@ export interface SplitButtonProps extends Omit<ButtonProps, 'onSelect'>, CommonP
/**
* 弹层对齐方式, 详情见 Overlay align
* @en Align of popup, @see Overlay doc for detail
* @defaultValue 'tl bl'
*/
popupAlign?: string;

Expand Down

0 comments on commit 9019167

Please sign in to comment.