Skip to content

Commit b4258dc

Browse files
committed
feat: support vue 3.3 slot type
1 parent 9499a7f commit b4258dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+452
-181
lines changed

components/anchor/AnchorLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default defineComponent({
2121
name: 'AAnchorLink',
2222
props: initDefaultProps(anchorLinkProps(), { href: '#' }),
2323
slots: Object as CustomSlotsType<{
24-
title: AnchorLinkProps;
24+
title: any;
2525
default: any;
2626
}>,
2727
setup(props, { slots }) {

components/avatar/Avatar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const Avatar = defineComponent({
4242
inheritAttrs: false,
4343
props: avatarProps(),
4444
slots: Object as CustomSlotsType<{
45-
icon: AvatarProps;
45+
icon: any;
4646
default: any;
4747
}>,
4848
setup(props, { slots, attrs }) {

components/badge/Badge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default defineComponent({
4141
inheritAttrs: false,
4242
props: badgeProps(),
4343
slots: Object as CustomSlotsType<{
44-
text: BadgeProps;
44+
text: any;
4545
count: any;
4646
default: any;
4747
}>,

components/breadcrumb/Breadcrumb.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default defineComponent({
5656
name: 'ABreadcrumb',
5757
props: breadcrumbProps(),
5858
slots: Object as CustomSlotsType<{
59-
separator: BreadcrumbProps;
59+
separator: any;
6060
itemRender: { route: Route; params: any; routes: Route[]; paths: string[] };
6161
default: any;
6262
}>,

components/breadcrumb/BreadcrumbItem.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import DropDown from '../dropdown/dropdown';
66
import DownOutlined from '@ant-design/icons-vue/DownOutlined';
77
import useConfigInject from '../_util/hooks/useConfigInject';
88
import type { MouseEventHandler } from '../_util/EventInterface';
9+
import type { CustomSlotsType } from '../_util/type';
910

1011
export const breadcrumbItemProps = () => ({
1112
prefixCls: String,
@@ -23,7 +24,11 @@ export default defineComponent({
2324
__ANT_BREADCRUMB_ITEM: true,
2425
props: breadcrumbItemProps(),
2526
// emits: ['click'],
26-
slots: ['separator', 'overlay'],
27+
slots: Object as CustomSlotsType<{
28+
separator: any;
29+
overlay: any;
30+
default: any;
31+
}>,
2732
setup(props, { slots, attrs }) {
2833
const { prefixCls } = useConfigInject('breadcrumb', props);
2934
/**

components/calendar/generateCalendar.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type {
1111
import { useLocaleReceiver } from '../locale-provider/LocaleReceiver';
1212
import enUS from './locale/en_US';
1313
import CalendarHeader from './Header';
14-
import type { VueNode } from '../_util/type';
14+
import type { CustomSlotsType, VueNode } from '../_util/type';
1515
import type { App } from 'vue';
1616
import { computed, defineComponent, toRef } from 'vue';
1717
import useConfigInject from '../_util/hooks/useConfigInject';
@@ -108,13 +108,19 @@ function generateCalendar<
108108
'onSelect',
109109
'valueFormat',
110110
] as any,
111-
slots: [
112-
'dateFullCellRender',
113-
'dateCellRender',
114-
'monthFullCellRender',
115-
'monthCellRender',
116-
'headerRender',
117-
],
111+
slots: Object as CustomSlotsType<{
112+
dateFullCellRender?: { current: DateType };
113+
dateCellRender?: { current: DateType };
114+
monthFullCellRender?: { current: DateType };
115+
monthCellRender?: { current: DateType };
116+
headerRender?: {
117+
value: DateType;
118+
type: CalendarMode;
119+
onChange: (date: DateType) => void;
120+
onTypeChange: (type: CalendarMode) => void;
121+
};
122+
default: any;
123+
}>,
118124
setup(props, { emit, slots, attrs }) {
119125
const { prefixCls, direction } = useConfigInject('picker', props);
120126
const calendarPrefixCls = computed(() => `${prefixCls.value}-calendar`);

components/card/Card.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { SizeType } from '../config-provider';
99
import isPlainObject from 'lodash-es/isPlainObject';
1010
import useConfigInject from '../_util/hooks/useConfigInject';
1111
import devWarning from '../vc-util/devWarning';
12+
import type { CustomSlotsType } from '../_util/type';
1213
export interface CardTabListType {
1314
key: string;
1415
tab: any;
@@ -52,7 +53,15 @@ const Card = defineComponent({
5253
compatConfig: { MODE: 3 },
5354
name: 'ACard',
5455
props: cardProps(),
55-
slots: ['title', 'extra', 'tabBarExtraContent', 'actions', 'cover', 'customTab'],
56+
slots: Object as CustomSlotsType<{
57+
title: any;
58+
extra: any;
59+
tabBarExtraContent: any;
60+
actions: any;
61+
cover: any;
62+
customTab: CardTabListType;
63+
default: any;
64+
}>,
5665
setup(props, { slots }) {
5766
const { prefixCls, direction, size } = useConfigInject('card', props);
5867
const getAction = (actions: VNodeTypes[]) => {

components/card/Meta.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { defineComponent } from 'vue';
33
import PropTypes from '../_util/vue-types';
44
import { getPropsSlot } from '../_util/props-util';
55
import useConfigInject from '../_util/hooks/useConfigInject';
6+
import type { CustomSlotsType } from '../_util/type';
67

78
export const cardMetaProps = () => ({
89
prefixCls: String,
@@ -15,7 +16,12 @@ export default defineComponent({
1516
compatConfig: { MODE: 3 },
1617
name: 'ACardMeta',
1718
props: cardMetaProps(),
18-
slots: ['title', 'description', 'avatar'],
19+
slots: Object as CustomSlotsType<{
20+
title: any;
21+
description: any;
22+
avatar: any;
23+
default: any;
24+
}>,
1925
setup(props, { slots }) {
2026
const { prefixCls } = useConfigInject('card', props);
2127
return () => {

components/collapse/Collapse.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import classNames from '../_util/classNames';
1616
import useConfigInject from '../_util/hooks/useConfigInject';
1717
import type { CollapsePanelProps } from './CollapsePanel';
1818
import collapseMotion from '../_util/collapseMotion';
19+
import type { CustomSlotsType } from '../_util/type';
1920

2021
type Key = number | string;
2122

@@ -41,8 +42,10 @@ export default defineComponent({
4142
openAnimation: collapseMotion('ant-motion-collapse', false),
4243
expandIconPosition: 'left',
4344
}),
44-
slots: ['expandIcon'],
45-
// emits: ['change', 'update:activeKey'],
45+
slots: Object as CustomSlotsType<{
46+
default?: any;
47+
expandIcon?: CollapsePanelProps;
48+
}>,
4649
setup(props, { attrs, slots, emit }) {
4750
const stateActiveKey = ref<Key[]>(
4851
getActiveKeysArray(firstNotUndefined([props.activeKey, props.defaultActiveKey])),

components/collapse/CollapsePanel.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Transition from '../_util/transition';
77
import classNames from '../_util/classNames';
88
import devWarning from '../vc-util/devWarning';
99
import useConfigInject from '../_util/hooks/useConfigInject';
10+
import type { CustomSlotsType } from '../_util/type';
1011

1112
export { collapsePanelProps };
1213
export type CollapsePanelProps = Partial<ExtractPropTypes<ReturnType<typeof collapsePanelProps>>>;
@@ -21,7 +22,13 @@ export default defineComponent({
2122
headerClass: '',
2223
forceRender: false,
2324
}),
24-
slots: ['expandIcon', 'extra', 'header'],
25+
slots: Object as CustomSlotsType<{
26+
expandIcon?: any;
27+
extra?: any;
28+
header?: any;
29+
default?: any;
30+
}>,
31+
2532
// emits: ['itemClick'],
2633
setup(props, { slots, emit, attrs }) {
2734
devWarning(

0 commit comments

Comments
 (0)