Skip to content

Commit d71df4b

Browse files
committed
fix: component ts type
1 parent b13756f commit d71df4b

File tree

20 files changed

+111
-197
lines changed

20 files changed

+111
-197
lines changed

components/checkbox/Checkbox.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ export default defineComponent({
5959
});
6060
return () => {
6161
const children = flattenChildren(slots.default?.());
62-
const { indeterminate, skipGroup, id = formItemContext.id.value, ...restProps } = props;
62+
const {
63+
indeterminate,
64+
skipGroup,
65+
id = formItemContext.id.value,
66+
onClick,
67+
...restProps
68+
} = props;
6369
const { onMouseenter, onMouseleave, onInput, class: className, style, ...restAttrs } = attrs;
6470
const checkboxProps: CheckboxProps = {
6571
...restProps,
@@ -97,6 +103,7 @@ export default defineComponent({
97103
style={style}
98104
onMouseenter={onMouseenter as EventHandler}
99105
onMouseleave={onMouseleave as EventHandler}
106+
onClick={onClick}
100107
>
101108
<VcCheckbox {...checkboxProps} class={checkboxClass} ref={checkboxRef} />
102109
{children.length ? <span>{children}</span> : null}

components/checkbox/interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const abstractCheckboxProps = () => {
5353
autofocus: { type: Boolean, default: undefined },
5454
onChange: PropTypes.func,
5555
'onUpdate:checked': PropTypes.func,
56+
onClick: PropTypes.func,
5657
skipGroup: { type: Boolean, default: false },
5758
};
5859
};

components/components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export { default as List, ListItem, ListItemMeta } from './list';
102102
export type { MessageArgsProps } from './message';
103103
export { default as message } from './message';
104104

105-
export type { MenuProps, MenuTheme, SubMenuProps, MenuItemProps } from './menu';
105+
export type { MenuProps, MenuTheme, SubMenuProps, MenuItemProps, MenuMode } from './menu';
106106
export { default as Menu, MenuDivider, MenuItem, MenuItemGroup, SubMenu } from './menu';
107107

108108
export type { MentionsProps } from './mentions';

components/input-number/src/InputNumber.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ export const inputNumberProps = {
7474
(value: ValueType, info: { offset: ValueType; type: 'up' | 'down' }) => void
7575
>,
7676
},
77+
onBlur: { type: Function as PropType<(e: InputEvent) => void> },
78+
onFocus: { type: Function as PropType<(e: InputEvent) => void> },
7779
};
7880

7981
export default defineComponent({

components/menu/demo/switch-mode.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ import {
7878
AppstoreOutlined,
7979
SettingOutlined,
8080
} from '@ant-design/icons-vue';
81+
import type { MenuMode, MenuTheme } from 'ant-design-vue';
8182
export default defineComponent({
8283
components: {
8384
MailOutlined,
@@ -87,8 +88,8 @@ export default defineComponent({
8788
},
8889
setup() {
8990
const state = reactive({
90-
mode: 'inline',
91-
theme: 'light',
91+
mode: 'inline' as MenuMode,
92+
theme: 'light' as MenuTheme,
9293
selectedKeys: ['1'],
9394
openKeys: ['sub1'],
9495
});

components/menu/demo/theme.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ import {
7878
AppstoreOutlined,
7979
SettingOutlined,
8080
} from '@ant-design/icons-vue';
81+
import type { MenuTheme } from 'ant-design-vue';
8182
export default defineComponent({
8283
components: {
8384
MailOutlined,
@@ -87,7 +88,7 @@ export default defineComponent({
8788
},
8889
setup() {
8990
const state = reactive({
90-
theme: 'dark',
91+
theme: 'dark' as MenuTheme,
9192
selectedKeys: ['1'],
9293
openKeys: ['sub1'],
9394
});

components/menu/demo/vertical.vue

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,8 @@ import {
6868
AppstoreOutlined,
6969
SettingOutlined,
7070
} from '@ant-design/icons-vue';
71+
import type { MenuProps } from 'ant-design-vue';
7172
72-
interface MenuInfo {
73-
key: string;
74-
keyPath: string[];
75-
item: any;
76-
domEvent: MouseEvent;
77-
}
7873
export default defineComponent({
7974
components: {
8075
MailOutlined,
@@ -87,8 +82,8 @@ export default defineComponent({
8782
selectedKeys: [],
8883
openKeys: [],
8984
});
90-
const handleClick = (e: MenuInfo) => {
91-
console.log('click ', e);
85+
const handleClick: MenuProps['onClick'] = menuInfo => {
86+
console.log('click ', menuInfo);
9287
};
9388
return {
9489
...toRefs(state),

components/menu/index.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ More layouts with navigation: [Layout](/components/layout).
3434
| forceSubMenuRender | render submenu into DOM before it shows | boolean | false |
3535
| inlineCollapsed | specifies the collapsed status when menu is inline mode | boolean | - |
3636
| inlineIndent | indent px of inline menu item on each level | number | 24 |
37-
| mode | type of the menu; `vertical`, `horizontal`, and `inline` modes are supported | string: `vertical` \| `vertical-right` \| `horizontal` \| `inline` | `vertical` |
37+
| mode | type of the menu; `vertical`, `horizontal`, and `inline` modes are supported | `vertical` \| `horizontal` \| `inline` | `vertical` |
3838
| multiple | Allow selection of multiple items | boolean | false |
3939
| openKeys(v-model) | array with the keys of currently opened sub menus | string\[] | |
4040
| selectable | allow selecting menu items | boolean | true |

components/menu/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { MenuItemGroupProps } from './src/ItemGroup';
88
import ItemGroup from './src/ItemGroup';
99
import Divider from './src/Divider';
1010
import type { App, Plugin } from 'vue';
11-
import type { MenuTheme } from './src/interface';
11+
import type { MenuTheme, MenuMode } from './src/interface';
1212
/* istanbul ignore next */
1313
Menu.install = function (app: App) {
1414
app.component(Menu.name, Menu);
@@ -23,7 +23,7 @@ Menu.Item = MenuItem;
2323
Menu.Divider = Divider;
2424
Menu.SubMenu = SubMenu;
2525
Menu.ItemGroup = ItemGroup;
26-
export type { MenuProps, SubMenuProps, MenuItemProps, MenuItemGroupProps, MenuTheme };
26+
export type { MenuProps, SubMenuProps, MenuItemProps, MenuItemGroupProps, MenuTheme, MenuMode };
2727
export {
2828
SubMenu,
2929
MenuItem as Item,

components/menu/index.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/3XZcjGpvK/Menu.svg
3535
| forceSubMenuRender | 在子菜单展示之前就渲染进 DOM | boolean | false |
3636
| inlineCollapsed | inline 时菜单是否收起状态 | boolean | - |
3737
| inlineIndent | inline 模式的菜单缩进宽度 | number | 24 |
38-
| mode | 菜单类型,现在支持垂直、水平、和内嵌模式三种 | string: `vertical` `vertical-right` `horizontal` `inline` | `vertical` |
38+
| mode | 菜单类型,现在支持垂直、水平、和内嵌模式三种 | `vertical` \| `horizontal` \| `inline` | `vertical` |
3939
| multiple | 是否允许多选 | boolean | false |
4040
| openKeys(v-model) | 当前展开的 SubMenu 菜单项 key 数组 | string\[] | |
4141
| selectable | 是否允许选中 | boolean | true |

0 commit comments

Comments
 (0)