Skip to content

Commit

Permalink
Merge pull request #94 from ant-design/feat/updateAction
Browse files Browse the repository at this point in the history
✏️ fix: action types fixed
  • Loading branch information
ONLY-yours authored Oct 31, 2023
2 parents 6119c9d + 7df5f4e commit 5c2988e
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 64 deletions.
1 change: 1 addition & 0 deletions src/ActionGroup/demos/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default () => {
items={[
{
icon: <CopyOutlined />,
placement: 'bottom',
onClick: () => {
messageApi.info('复制!');
},
Expand Down
9 changes: 6 additions & 3 deletions src/ActionGroup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import {
RedoOutlined,
UndoOutlined,
} from '@ant-design/icons';
import { ActionIcon, getPrefixCls } from '@ant-design/pro-editor';
import { ActionIcon, ActionIconProps, getPrefixCls } from '@ant-design/pro-editor';
import { Divider, Dropdown, DropdownProps } from 'antd';
import { useStyle } from './style';

export type ActionIconGroupItemType = {
export type ActionIconGroupItemType = ActionIconProps & {
/**
* @description 展示的 icon
*/
Expand Down Expand Up @@ -142,6 +142,7 @@ const ActionGroup = (props: ActionGroupProps) => {
if (item?.type)
return (
<Divider
key={`action-divider-${index}`}
type={direction === 'row' ? 'vertical' : 'horizontal'}
style={{
margin: `${direction === 'row' ? '0 4px' : '4px 0'}`,
Expand All @@ -155,7 +156,9 @@ const ActionGroup = (props: ActionGroupProps) => {
size={size}
{...item}
onClick={() => {
item?.onClick();
if (item?.onClick) {
item?.onClick();
}
onClick(item?.key);
}}
/>
Expand Down
15 changes: 14 additions & 1 deletion src/ActionIcon/ActionIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ export interface ActionIconProps extends Omit<ButtonProps, 'title' | 'size'> {
* @title 图标尺寸
*/
size?: 'default' | 'large' | number;
/**
* @description 鼠标移入时候的延迟tooltip时间,默认 0.5
* @default 0.5
*/
tooltipDelay?: number;
/**
* @description 是否展示小箭头,默认不展示
* @default false
*/
arrow?: boolean;
}

const ActionIcon: FC<ActionIconProps> = ({
Expand All @@ -43,7 +53,9 @@ const ActionIcon: FC<ActionIconProps> = ({
cursor,
onClick,
className,
arrow = false,
size,
tooltipDelay = 0.5,
prefixCls: customPrefixCls,
...restProps
}) => {
Expand Down Expand Up @@ -77,9 +89,10 @@ const ActionIcon: FC<ActionIconProps> = ({
Icon
) : (
<Tooltip
arrow={false}
arrow={arrow}
overlayClassName={styles.tooltip}
title={title}
mouseEnterDelay={tooltipDelay}
placement={placement}
>
{Icon}
Expand Down
8 changes: 4 additions & 4 deletions src/Highlight/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ group: 基础组件

## 何时使用

展示代码时使用,不需要编辑代码时使用
展示代码时使用,不需要编辑代码时使用

## 代码演示

### 指定语言

你可以通过 `language` 指定语言高亮,通过 `theme` 指定高亮主题
你可以通过 `language` 指定语言高亮,通过 `theme` 指定高亮主题

<code src="./demos/basic.tsx" ></code>

### 展示代码块行号

你可以通过 `lineNumber` 指定是否需要展示代码块行号
你可以通过 `lineNumber` 指定是否需要展示代码块行号

<code src="./demos/lineNumber.tsx" ></code>

### 主题 & 语言 & 行号 & 渲染器

你可以通过这个示例查看不同语言在不同主题下的效果
你可以通过这个示例查看不同语言在不同主题下的效果

<code src="./demos/theme.tsx" ></code>

Expand Down
Loading

0 comments on commit 5c2988e

Please sign in to comment.