},
},
- slots: ['title', 'icon', 'switcherIcon', 'checkable'],
setup(props, { attrs, slots }) {
const visible = ref(true);
const context = useInjectTreeContext();
diff --git a/components/vc-tree/Tree.tsx b/components/vc-tree/Tree.tsx
index 828d52533..dbf81a8c5 100644
--- a/components/vc-tree/Tree.tsx
+++ b/components/vc-tree/Tree.tsx
@@ -55,7 +55,6 @@ export default defineComponent({
compatConfig: { MODE: 3 },
name: 'Tree',
inheritAttrs: false,
- slots: ['checkable', 'title', 'icon', 'titleRender'],
props: initDefaultProps(treeProps(), {
prefixCls: 'vc-tree',
showLine: false,
diff --git a/components/vc-tree/TreeNode.tsx b/components/vc-tree/TreeNode.tsx
index 05dca54b4..309fd0dad 100644
--- a/components/vc-tree/TreeNode.tsx
+++ b/components/vc-tree/TreeNode.tsx
@@ -29,7 +29,6 @@ export default defineComponent({
inheritAttrs: false,
props: treeNodeProps,
isTreeNode: 1,
- slots: ['title', 'icon', 'switcherIcon'],
setup(props, { attrs, slots, expose }) {
warning(
!('slots' in props.data),
From b4258dc23da50fb366446420fe8de65ddb8e86cf Mon Sep 17 00:00:00 2001
From: tangjinzhou <415800467@qq.com>
Date: Thu, 18 May 2023 21:22:58 +0800
Subject: [PATCH 5/6] feat: support vue 3.3 slot type
---
components/anchor/AnchorLink.tsx | 2 +-
components/avatar/Avatar.tsx | 2 +-
components/badge/Badge.tsx | 2 +-
components/breadcrumb/Breadcrumb.tsx | 2 +-
components/breadcrumb/BreadcrumbItem.tsx | 7 +++-
components/calendar/generateCalendar.tsx | 22 ++++++----
components/card/Card.tsx | 11 ++++-
components/card/Meta.tsx | 8 +++-
components/collapse/Collapse.tsx | 7 +++-
components/collapse/CollapsePanel.tsx | 9 ++++-
components/comment/index.tsx | 14 +++++--
.../generatePicker/generateRangePicker.tsx | 25 ++++++------
.../generatePicker/generateSinglePicker.tsx | 28 +++++++------
components/descriptions/index.tsx | 8 +++-
components/drawer/index.tsx | 14 +++++--
components/dropdown/dropdown-button.tsx | 11 ++++-
components/dropdown/dropdown.tsx | 6 ++-
components/form/FormItem.tsx | 8 +++-
components/form/FormItemInput.tsx | 9 ++++-
components/input-number/index.tsx | 9 ++++-
components/input-number/src/InputNumber.tsx | 7 +++-
components/input-number/src/StepHandler.tsx | 7 +++-
components/list/Item.tsx | 7 +++-
components/list/ItemMeta.tsx | 8 +++-
components/list/index.tsx | 11 ++++-
components/mentions/index.tsx | 7 +++-
components/menu/src/ItemGroup.tsx | 6 ++-
components/menu/src/Menu.tsx | 12 ++++--
components/menu/src/MenuItem.tsx | 9 ++++-
components/menu/src/PopupTrigger.tsx | 6 ++-
components/menu/src/SubMenu.tsx | 10 +++--
components/page-header/index.tsx | 13 +++++-
components/popconfirm/index.tsx | 12 +++++-
components/progress/progress.tsx | 7 +++-
components/result/index.tsx | 9 ++++-
components/select/index.tsx | 29 +++++++-------
components/slider/index.tsx | 7 +++-
components/space/index.tsx | 6 ++-
components/statistic/Statistic.tsx | 9 ++++-
components/steps/index.tsx | 7 +++-
components/switch/index.tsx | 7 +++-
components/table/Column.tsx | 8 +++-
components/table/ColumnGroup.tsx | 6 ++-
components/table/Table.tsx | 29 +++++++-------
.../tabs/src/TabNavList/OperationNode.tsx | 7 +++-
components/tabs/src/TabNavList/index.tsx | 10 ++++-
components/tabs/src/TabPanelList/TabPane.tsx | 7 +++-
components/tabs/src/Tabs.tsx | 40 ++++++++++---------
components/tag/index.tsx | 8 +++-
components/time-picker/time-picker.tsx | 16 +++++++-
components/timeline/Timeline.tsx | 7 +++-
components/timeline/TimelineItem.tsx | 7 +++-
components/tooltip/Tooltip.tsx | 6 ++-
components/transfer/index.tsx | 23 ++++++-----
components/transfer/list.tsx | 7 +++-
components/tree-select/index.tsx | 20 +++++-----
components/tree/DirectoryTree.tsx | 10 ++++-
components/tree/Tree.tsx | 20 +++++-----
components/vc-overflow/RawItem.tsx | 2 +
59 files changed, 452 insertions(+), 181 deletions(-)
diff --git a/components/anchor/AnchorLink.tsx b/components/anchor/AnchorLink.tsx
index 24724f775..bea3f52d6 100644
--- a/components/anchor/AnchorLink.tsx
+++ b/components/anchor/AnchorLink.tsx
@@ -21,7 +21,7 @@ export default defineComponent({
name: 'AAnchorLink',
props: initDefaultProps(anchorLinkProps(), { href: '#' }),
slots: Object as CustomSlotsType<{
- title: AnchorLinkProps;
+ title: any;
default: any;
}>,
setup(props, { slots }) {
diff --git a/components/avatar/Avatar.tsx b/components/avatar/Avatar.tsx
index 437c92710..67522741e 100644
--- a/components/avatar/Avatar.tsx
+++ b/components/avatar/Avatar.tsx
@@ -42,7 +42,7 @@ const Avatar = defineComponent({
inheritAttrs: false,
props: avatarProps(),
slots: Object as CustomSlotsType<{
- icon: AvatarProps;
+ icon: any;
default: any;
}>,
setup(props, { slots, attrs }) {
diff --git a/components/badge/Badge.tsx b/components/badge/Badge.tsx
index 3db3f141d..d7c0f151d 100644
--- a/components/badge/Badge.tsx
+++ b/components/badge/Badge.tsx
@@ -41,7 +41,7 @@ export default defineComponent({
inheritAttrs: false,
props: badgeProps(),
slots: Object as CustomSlotsType<{
- text: BadgeProps;
+ text: any;
count: any;
default: any;
}>,
diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx
index 9b1e8d776..c14eaa1d5 100644
--- a/components/breadcrumb/Breadcrumb.tsx
+++ b/components/breadcrumb/Breadcrumb.tsx
@@ -56,7 +56,7 @@ export default defineComponent({
name: 'ABreadcrumb',
props: breadcrumbProps(),
slots: Object as CustomSlotsType<{
- separator: BreadcrumbProps;
+ separator: any;
itemRender: { route: Route; params: any; routes: Route[]; paths: string[] };
default: any;
}>,
diff --git a/components/breadcrumb/BreadcrumbItem.tsx b/components/breadcrumb/BreadcrumbItem.tsx
index a00d0e324..c7f2fa7a3 100644
--- a/components/breadcrumb/BreadcrumbItem.tsx
+++ b/components/breadcrumb/BreadcrumbItem.tsx
@@ -6,6 +6,7 @@ import DropDown from '../dropdown/dropdown';
import DownOutlined from '@ant-design/icons-vue/DownOutlined';
import useConfigInject from '../_util/hooks/useConfigInject';
import type { MouseEventHandler } from '../_util/EventInterface';
+import type { CustomSlotsType } from '../_util/type';
export const breadcrumbItemProps = () => ({
prefixCls: String,
@@ -23,7 +24,11 @@ export default defineComponent({
__ANT_BREADCRUMB_ITEM: true,
props: breadcrumbItemProps(),
// emits: ['click'],
- slots: ['separator', 'overlay'],
+ slots: Object as CustomSlotsType<{
+ separator: any;
+ overlay: any;
+ default: any;
+ }>,
setup(props, { slots, attrs }) {
const { prefixCls } = useConfigInject('breadcrumb', props);
/**
diff --git a/components/calendar/generateCalendar.tsx b/components/calendar/generateCalendar.tsx
index 991911ecf..6b6717f71 100644
--- a/components/calendar/generateCalendar.tsx
+++ b/components/calendar/generateCalendar.tsx
@@ -11,7 +11,7 @@ import type {
import { useLocaleReceiver } from '../locale-provider/LocaleReceiver';
import enUS from './locale/en_US';
import CalendarHeader from './Header';
-import type { VueNode } from '../_util/type';
+import type { CustomSlotsType, VueNode } from '../_util/type';
import type { App } from 'vue';
import { computed, defineComponent, toRef } from 'vue';
import useConfigInject from '../_util/hooks/useConfigInject';
@@ -108,13 +108,19 @@ function generateCalendar<
'onSelect',
'valueFormat',
] as any,
- slots: [
- 'dateFullCellRender',
- 'dateCellRender',
- 'monthFullCellRender',
- 'monthCellRender',
- 'headerRender',
- ],
+ slots: Object as CustomSlotsType<{
+ dateFullCellRender?: { current: DateType };
+ dateCellRender?: { current: DateType };
+ monthFullCellRender?: { current: DateType };
+ monthCellRender?: { current: DateType };
+ headerRender?: {
+ value: DateType;
+ type: CalendarMode;
+ onChange: (date: DateType) => void;
+ onTypeChange: (type: CalendarMode) => void;
+ };
+ default: any;
+ }>,
setup(props, { emit, slots, attrs }) {
const { prefixCls, direction } = useConfigInject('picker', props);
const calendarPrefixCls = computed(() => `${prefixCls.value}-calendar`);
diff --git a/components/card/Card.tsx b/components/card/Card.tsx
index d3484716f..82925226d 100644
--- a/components/card/Card.tsx
+++ b/components/card/Card.tsx
@@ -9,6 +9,7 @@ import type { SizeType } from '../config-provider';
import isPlainObject from 'lodash-es/isPlainObject';
import useConfigInject from '../_util/hooks/useConfigInject';
import devWarning from '../vc-util/devWarning';
+import type { CustomSlotsType } from '../_util/type';
export interface CardTabListType {
key: string;
tab: any;
@@ -52,7 +53,15 @@ const Card = defineComponent({
compatConfig: { MODE: 3 },
name: 'ACard',
props: cardProps(),
- slots: ['title', 'extra', 'tabBarExtraContent', 'actions', 'cover', 'customTab'],
+ slots: Object as CustomSlotsType<{
+ title: any;
+ extra: any;
+ tabBarExtraContent: any;
+ actions: any;
+ cover: any;
+ customTab: CardTabListType;
+ default: any;
+ }>,
setup(props, { slots }) {
const { prefixCls, direction, size } = useConfigInject('card', props);
const getAction = (actions: VNodeTypes[]) => {
diff --git a/components/card/Meta.tsx b/components/card/Meta.tsx
index 3778e3941..214e4a61b 100644
--- a/components/card/Meta.tsx
+++ b/components/card/Meta.tsx
@@ -3,6 +3,7 @@ import { defineComponent } from 'vue';
import PropTypes from '../_util/vue-types';
import { getPropsSlot } from '../_util/props-util';
import useConfigInject from '../_util/hooks/useConfigInject';
+import type { CustomSlotsType } from '../_util/type';
export const cardMetaProps = () => ({
prefixCls: String,
@@ -15,7 +16,12 @@ export default defineComponent({
compatConfig: { MODE: 3 },
name: 'ACardMeta',
props: cardMetaProps(),
- slots: ['title', 'description', 'avatar'],
+ slots: Object as CustomSlotsType<{
+ title: any;
+ description: any;
+ avatar: any;
+ default: any;
+ }>,
setup(props, { slots }) {
const { prefixCls } = useConfigInject('card', props);
return () => {
diff --git a/components/collapse/Collapse.tsx b/components/collapse/Collapse.tsx
index 12159363b..caee7761c 100644
--- a/components/collapse/Collapse.tsx
+++ b/components/collapse/Collapse.tsx
@@ -16,6 +16,7 @@ import classNames from '../_util/classNames';
import useConfigInject from '../_util/hooks/useConfigInject';
import type { CollapsePanelProps } from './CollapsePanel';
import collapseMotion from '../_util/collapseMotion';
+import type { CustomSlotsType } from '../_util/type';
type Key = number | string;
@@ -41,8 +42,10 @@ export default defineComponent({
openAnimation: collapseMotion('ant-motion-collapse', false),
expandIconPosition: 'left',
}),
- slots: ['expandIcon'],
- // emits: ['change', 'update:activeKey'],
+ slots: Object as CustomSlotsType<{
+ default?: any;
+ expandIcon?: CollapsePanelProps;
+ }>,
setup(props, { attrs, slots, emit }) {
const stateActiveKey = ref
(
getActiveKeysArray(firstNotUndefined([props.activeKey, props.defaultActiveKey])),
diff --git a/components/collapse/CollapsePanel.tsx b/components/collapse/CollapsePanel.tsx
index b799a38e3..281611fde 100644
--- a/components/collapse/CollapsePanel.tsx
+++ b/components/collapse/CollapsePanel.tsx
@@ -7,6 +7,7 @@ import Transition from '../_util/transition';
import classNames from '../_util/classNames';
import devWarning from '../vc-util/devWarning';
import useConfigInject from '../_util/hooks/useConfigInject';
+import type { CustomSlotsType } from '../_util/type';
export { collapsePanelProps };
export type CollapsePanelProps = Partial>>;
@@ -21,7 +22,13 @@ export default defineComponent({
headerClass: '',
forceRender: false,
}),
- slots: ['expandIcon', 'extra', 'header'],
+ slots: Object as CustomSlotsType<{
+ expandIcon?: any;
+ extra?: any;
+ header?: any;
+ default?: any;
+ }>,
+
// emits: ['itemClick'],
setup(props, { slots, emit, attrs }) {
devWarning(
diff --git a/components/comment/index.tsx b/components/comment/index.tsx
index 7858d4a25..8502f1a56 100644
--- a/components/comment/index.tsx
+++ b/components/comment/index.tsx
@@ -2,7 +2,7 @@ import type { ExtractPropTypes } from 'vue';
import { defineComponent } from 'vue';
import PropTypes from '../_util/vue-types';
import { flattenChildren } from '../_util/props-util';
-import type { VueNode } from '../_util/type';
+import type { CustomSlotsType, VueNode } from '../_util/type';
import { withInstall } from '../_util/type';
import useConfigInject from '../_util/hooks/useConfigInject';
export const commentProps = () => ({
@@ -25,7 +25,15 @@ const Comment = defineComponent({
compatConfig: { MODE: 3 },
name: 'AComment',
props: commentProps(),
- slots: ['actions', 'author', 'avatar', 'content', 'datetime'],
+
+ slots: Object as CustomSlotsType<{
+ actions: any;
+ author: any;
+ avatar: any;
+ content: any;
+ datetime: any;
+ default: any;
+ }>,
setup(props, { slots }) {
const { prefixCls, direction } = useConfigInject('comment', props);
const renderNested = (prefixCls: string, children: VueNode) => {
@@ -41,7 +49,7 @@ const Comment = defineComponent({
return () => {
const pre = prefixCls.value;
- const actions = props.actions ?? slots.actions?.();
+ const actions: any[] = props.actions ?? slots.actions?.();
const author = props.author ?? slots.author?.();
const avatar = props.avatar ?? slots.avatar?.();
const content = props.content ?? slots.content?.();
diff --git a/components/date-picker/generatePicker/generateRangePicker.tsx b/components/date-picker/generatePicker/generateRangePicker.tsx
index 13e6f2a61..a14ec2617 100644
--- a/components/date-picker/generatePicker/generateRangePicker.tsx
+++ b/components/date-picker/generatePicker/generateRangePicker.tsx
@@ -18,6 +18,7 @@ import type { RangePickerSharedProps } from '../../vc-picker/RangePicker';
import devWarning from '../../vc-util/devWarning';
import { useInjectFormItemContext } from '../../form/FormItemContext';
import omit from '../../_util/omit';
+import type { CustomSlotsType } from '../../_util/type';
export default function generateRangePicker(
generateConfig: GenerateConfig,
@@ -32,18 +33,18 @@ export default function generateRangePicker(
...rangePickerProps(),
...extraProps,
},
- slots: [
- 'suffixIcon',
- // 'clearIcon',
- 'prevIcon',
- 'nextIcon',
- 'superPrevIcon',
- 'superNextIcon',
- // 'panelRender',
- 'dateRender',
- 'renderExtraFooter',
- // 'separator',
- ],
+ slots: Object as CustomSlotsType<{
+ suffixIcon?: any;
+ prevIcon?: any;
+ nextIcon?: any;
+ superPrevIcon?: any;
+ superNextIcon?: any;
+ dateRender?: any;
+ renderExtraFooter?: any;
+ default?: any;
+ separator?: any;
+ clearIcon?: any;
+ }>,
setup(_props, { expose, slots, attrs, emit }) {
const props = _props as unknown as CommonProps & RangePickerProps;
const formItemContext = useInjectFormItemContext();
diff --git a/components/date-picker/generatePicker/generateSinglePicker.tsx b/components/date-picker/generatePicker/generateSinglePicker.tsx
index 97b2563fe..712c925e9 100644
--- a/components/date-picker/generatePicker/generateSinglePicker.tsx
+++ b/components/date-picker/generatePicker/generateSinglePicker.tsx
@@ -16,6 +16,7 @@ import { commonProps, datePickerProps } from './props';
import devWarning from '../../vc-util/devWarning';
import { useInjectFormItemContext } from '../../form/FormItemContext';
+import type { CustomSlotsType } from '../../_util/type';
export default function generateSinglePicker(
generateConfig: GenerateConfig,
@@ -32,18 +33,19 @@ export default function generateSinglePicker(
name: displayName,
inheritAttrs: false,
props: comProps,
- slots: [
- 'suffixIcon',
- // 'clearIcon',
- 'prevIcon',
- 'nextIcon',
- 'superPrevIcon',
- 'superNextIcon',
- // 'panelRender',
- 'dateRender',
- 'renderExtraFooter',
- 'monthCellRender',
- ],
+ slots: Object as CustomSlotsType<{
+ suffixIcon?: any;
+ prevIcon?: any;
+ nextIcon?: any;
+ superPrevIcon?: any;
+ superNextIcon?: any;
+ dateRender?: any;
+ renderExtraFooter?: any;
+ monthCellRender?: any;
+ monthCellContentRender?: any;
+ clearIcon?: any;
+ default?: any;
+ }>,
setup(_props, { slots, expose, attrs, emit }) {
// 兼容 vue 3.2.7
const props = _props as unknown as CommonProps &
@@ -154,7 +156,7 @@ export default function generateSinglePicker(
id = formItemContext.id.value,
...restProps
} = p;
- const showTime = p.showTime === '' ? true : p.showTime;
+ const showTime = (p.showTime as string) === '' ? true : p.showTime;
const { format } = p as any;
let additionalOverrideProps: any = {};
diff --git a/components/descriptions/index.tsx b/components/descriptions/index.tsx
index 956063b6f..9f50604be 100644
--- a/components/descriptions/index.tsx
+++ b/components/descriptions/index.tsx
@@ -26,6 +26,7 @@ import PropTypes from '../_util/vue-types';
import { cloneElement } from '../_util/vnode';
import { flattenChildren } from '../_util/props-util';
import useConfigInject from '../_util/hooks/useConfigInject';
+import type { CustomSlotsType } from '../_util/type';
export const DescriptionsItemProps = {
prefixCls: String,
@@ -49,7 +50,6 @@ export const DescriptionsItem = defineComponent({
compatConfig: { MODE: 3 },
name: 'ADescriptionsItem',
props: descriptionsItemProp(),
- slots: ['label'],
setup(_, { slots }) {
return () => slots.default?.();
},
@@ -161,7 +161,11 @@ const Descriptions = defineComponent({
compatConfig: { MODE: 3 },
name: 'ADescriptions',
props: descriptionsProps(),
- slots: ['title', 'extra'],
+ slots: Object as CustomSlotsType<{
+ title?: any;
+ extra?: any;
+ default?: any;
+ }>,
Item: DescriptionsItem,
setup(props, { slots }) {
const { prefixCls, direction } = useConfigInject('descriptions', props);
diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx
index 4f3325d35..904a3232e 100644
--- a/components/drawer/index.tsx
+++ b/components/drawer/index.tsx
@@ -16,6 +16,7 @@ import VcDrawer from '../vc-drawer';
import PropTypes from '../_util/vue-types';
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
import useConfigInject from '../_util/hooks/useConfigInject';
+import type { CustomSlotsType } from '../_util/type';
import { tuple, withInstall } from '../_util/type';
import omit from '../_util/omit';
import devWarning from '../vc-util/devWarning';
@@ -24,10 +25,10 @@ import type { KeyboardEventHandler, MouseEventHandler } from '../_util/EventInte
type ILevelMove = number | [number, number];
const PlacementTypes = tuple('top', 'right', 'bottom', 'left');
-export type placementType = typeof PlacementTypes[number];
+export type placementType = (typeof PlacementTypes)[number];
const SizeTypes = tuple('default', 'large');
-export type sizeType = typeof SizeTypes[number];
+export type sizeType = (typeof SizeTypes)[number];
export interface PushState {
distance: string | number;
@@ -102,7 +103,14 @@ const Drawer = defineComponent({
keyboard: true,
push: defaultPushState,
}),
- slots: ['closeIcon', 'title', 'extra', 'footer', 'handle'],
+ slots: Object as CustomSlotsType<{
+ closeIcon: any;
+ title: any;
+ extra: any;
+ footer: any;
+ handle: any;
+ default: any;
+ }>,
// emits: ['update:visible', 'close', 'afterVisibleChange'],
setup(props, { emit, slots, attrs }) {
const sPush = ref(false);
diff --git a/components/dropdown/dropdown-button.tsx b/components/dropdown/dropdown-button.tsx
index 88268ce94..8cf348d0a 100644
--- a/components/dropdown/dropdown-button.tsx
+++ b/components/dropdown/dropdown-button.tsx
@@ -7,6 +7,7 @@ import { initDefaultProps } from '../_util/props-util';
import { dropdownButtonProps } from './props';
import EllipsisOutlined from '@ant-design/icons-vue/EllipsisOutlined';
import useConfigInject from '../_util/hooks/useConfigInject';
+import type { CustomSlotsType } from '../_util/type';
const ButtonGroup = Button.Group;
export type DropdownButtonProps = Partial>>;
@@ -21,8 +22,14 @@ export default defineComponent({
placement: 'bottomRight',
type: 'default',
}),
- // emits: ['click', 'visibleChange', 'update:visible'],
- slots: ['icon', 'leftButton', 'rightButton', 'overlay'],
+ // emits: ['click', 'visibleChange', 'update:visible'],s
+ slots: Object as CustomSlotsType<{
+ icon: any;
+ leftButton: { button: any };
+ rightButton: { button: any };
+ overlay: any;
+ default: any;
+ }>,
setup(props, { slots, attrs, emit }) {
const handleVisibleChange = (val: boolean) => {
emit('update:visible', val);
diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx
index a2b4601f3..44864d8e7 100644
--- a/components/dropdown/dropdown.tsx
+++ b/components/dropdown/dropdown.tsx
@@ -11,6 +11,7 @@ import useConfigInject from '../_util/hooks/useConfigInject';
import devWarning from '../vc-util/devWarning';
import omit from '../_util/omit';
import getPlacements from '../tooltip/placements';
+import type { CustomSlotsType } from '../_util/type';
export type DropdownProps = Partial>>;
@@ -25,7 +26,10 @@ const Dropdown = defineComponent({
trigger: 'hover',
}),
// emits: ['visibleChange', 'update:visible'],
- slots: ['overlay'],
+ slots: Object as CustomSlotsType<{
+ default?: any;
+ overlay?: any;
+ }>,
setup(props, { slots, attrs, emit }) {
const { prefixCls, rootPrefixCls, direction, getPopupContainer } = useConfigInject(
'dropdown',
diff --git a/components/form/FormItem.tsx b/components/form/FormItem.tsx
index 7f72792bb..28d983454 100644
--- a/components/form/FormItem.tsx
+++ b/components/form/FormItem.tsx
@@ -26,6 +26,7 @@ import { getNamePath } from './utils/valueUtil';
import { toArray } from './utils/typeUtil';
import { warning } from '../vc-util/warning';
import find from 'lodash-es/find';
+import type { CustomSlotsType } from '../_util/type';
import { tuple } from '../_util/type';
import type {
FormLabelAlign,
@@ -133,7 +134,12 @@ export default defineComponent({
inheritAttrs: false,
__ANT_NEW_FORM_ITEM: true,
props: formItemProps(),
- slots: ['help', 'label', 'extra'],
+ slots: Object as CustomSlotsType<{
+ help: any;
+ label: any;
+ extra: any;
+ default: any;
+ }>,
setup(props, { slots, attrs, expose }) {
warning(props.prop === undefined, `\`prop\` is deprecated. Please use \`name\` instead.`);
const eventKey = `form-item-${++indexGuid}`;
diff --git a/components/form/FormItemInput.tsx b/components/form/FormItemInput.tsx
index a2eb6813c..1cc56f6f2 100644
--- a/components/form/FormItemInput.tsx
+++ b/components/form/FormItemInput.tsx
@@ -9,7 +9,7 @@ import { useProvideForm, useInjectForm, useProvideFormItemPrefix } from './conte
import ErrorList from './ErrorList';
import classNames from '../_util/classNames';
import type { ValidateStatus } from './FormItem';
-import type { VueNode } from '../_util/type';
+import type { CustomSlotsType, VueNode } from '../_util/type';
import type { HTMLAttributes } from 'vue';
import { computed, defineComponent } from 'vue';
@@ -35,7 +35,12 @@ const iconMap: { [key: string]: any } = {
};
const FormItemInput = defineComponent({
compatConfig: { MODE: 3 },
- slots: ['help', 'extra', 'errors'],
+ slots: Object as CustomSlotsType<{
+ help: any;
+ errors: any;
+ extra: any;
+ default: any;
+ }>,
inheritAttrs: false,
props: [
'prefixCls',
diff --git a/components/input-number/index.tsx b/components/input-number/index.tsx
index befae4517..9262fec37 100644
--- a/components/input-number/index.tsx
+++ b/components/input-number/index.tsx
@@ -11,6 +11,7 @@ import { cloneElement } from '../_util/vnode';
import omit from '../_util/omit';
import PropTypes from '../_util/vue-types';
import isValidValue from '../_util/isValidValue';
+import type { CustomSlotsType } from '../_util/type';
const baseProps = baseInputNumberProps();
export const inputNumberProps = () => ({
...baseProps,
@@ -35,7 +36,13 @@ const InputNumber = defineComponent({
inheritAttrs: false,
props: inputNumberProps(),
// emits: ['focus', 'blur', 'change', 'input', 'update:value'],
- slots: ['addonBefore', 'addonAfter', 'prefix'],
+ slots: Object as CustomSlotsType<{
+ addonBefore?: any;
+ addonAfter?: any;
+ prefix?: any;
+ default?: any;
+ }>,
+
setup(props, { emit, expose, attrs, slots }) {
const formItemContext = useInjectFormItemContext();
const { prefixCls, size, direction } = useConfigInject('input-number', props);
diff --git a/components/input-number/src/InputNumber.tsx b/components/input-number/src/InputNumber.tsx
index 6817e3be8..903e9109c 100644
--- a/components/input-number/src/InputNumber.tsx
+++ b/components/input-number/src/InputNumber.tsx
@@ -10,6 +10,7 @@ import { watch, computed, ref, defineComponent } from 'vue';
import type { ChangeEvent, KeyboardEventHandler } from '../../_util/EventInterface';
import KeyCode from '../../_util/KeyCode';
import classNames from '../../_util/classNames';
+import type { CustomSlotsType } from '../../_util/type';
/**
* We support `stringMode` which need handle correct type when user call in onChange
@@ -86,7 +87,11 @@ export default defineComponent({
...inputNumberProps(),
lazy: Boolean,
},
- slots: ['upHandler', 'downHandler'],
+ slots: Object as CustomSlotsType<{
+ upHandler: any;
+ downHandler: any;
+ default: any;
+ }>,
setup(props, { attrs, slots, emit, expose }) {
const inputRef = ref();
const focus = ref(false);
diff --git a/components/input-number/src/StepHandler.tsx b/components/input-number/src/StepHandler.tsx
index f63beb217..2a14a6e3a 100644
--- a/components/input-number/src/StepHandler.tsx
+++ b/components/input-number/src/StepHandler.tsx
@@ -2,6 +2,7 @@ import isMobile from '../../vc-util/isMobile';
import type { PropType } from 'vue';
import { onBeforeUnmount, ref, defineComponent } from 'vue';
import classNames from '../../_util/classNames';
+import type { CustomSlotsType } from '../../_util/type';
/**
* When click and hold on a button - the speed of auto changing the value.
@@ -23,7 +24,11 @@ export default defineComponent({
downDisabled: Boolean,
onStep: { type: Function as PropType<(up: boolean) => void> },
},
- slots: ['upNode', 'downNode'],
+ slots: Object as CustomSlotsType<{
+ upNode?: any;
+ downNode?: any;
+ default?: any;
+ }>,
setup(props, { slots, emit }) {
const stepTimeoutRef = ref();
diff --git a/components/list/Item.tsx b/components/list/Item.tsx
index 51bc83e5e..08ccf10e3 100644
--- a/components/list/Item.tsx
+++ b/components/list/Item.tsx
@@ -9,6 +9,7 @@ import ItemMeta from './ItemMeta';
import useConfigInject from '../_util/hooks/useConfigInject';
import { ListContextKey } from './contextKey';
import type { ListGridType } from '.';
+import type { CustomSlotsType } from '../_util/type';
export const listItemProps = () => ({
prefixCls: String,
@@ -25,7 +26,11 @@ export default defineComponent({
inheritAttrs: false,
Meta: ItemMeta,
props: listItemProps(),
- slots: ['actions', 'extra'],
+ slots: Object as CustomSlotsType<{
+ actions: any;
+ extra: any;
+ default: any;
+ }>,
setup(props, { slots, attrs }) {
const { itemLayout, grid } = inject(ListContextKey, {
grid: ref(),
diff --git a/components/list/ItemMeta.tsx b/components/list/ItemMeta.tsx
index 666043425..b515f97c2 100644
--- a/components/list/ItemMeta.tsx
+++ b/components/list/ItemMeta.tsx
@@ -2,6 +2,7 @@ import type { ExtractPropTypes } from 'vue';
import { defineComponent } from 'vue';
import useConfigInject from '../_util/hooks/useConfigInject';
import PropTypes from '../_util/vue-types';
+import type { CustomSlotsType } from '../_util/type';
export const listItemMetaProps = () => ({
avatar: PropTypes.any,
@@ -18,7 +19,12 @@ export default defineComponent({
props: listItemMetaProps(),
displayName: 'AListItemMeta', // 兼容历史函数式组件
__ANT_LIST_ITEM_META: true,
- slots: ['avatar', 'description', 'title'],
+ slots: Object as CustomSlotsType<{
+ avatar: any;
+ description: any;
+ title: any;
+ default: any;
+ }>,
setup(props, { slots }) {
const { prefixCls } = useConfigInject('list', props);
return () => {
diff --git a/components/list/index.tsx b/components/list/index.tsx
index 530d536dc..d61a97e05 100644
--- a/components/list/index.tsx
+++ b/components/list/index.tsx
@@ -11,7 +11,7 @@ import { Row } from '../grid';
import Item from './Item';
import { flattenChildren } from '../_util/props-util';
import initDefaultProps from '../_util/props-util/initDefaultProps';
-import type { Key } from '../_util/type';
+import type { CustomSlotsType, Key } from '../_util/type';
import ItemMeta from './ItemMeta';
import useConfigInject from '../_util/hooks/useConfigInject';
import useBreakpoint from '../_util/hooks/useBreakpoint';
@@ -87,7 +87,14 @@ const List = defineComponent({
loading: false,
pagination: false,
}),
- slots: ['extra', 'loadMore', 'renderItem', 'header', 'footer'],
+ slots: Object as CustomSlotsType<{
+ extra: any;
+ loadMore: any;
+ renderItem: { item: any; index: number };
+ header: any;
+ footer: any;
+ default: any;
+ }>,
setup(props, { slots }) {
provide(ListContextKey, {
grid: toRef(props, 'grid'),
diff --git a/components/mentions/index.tsx b/components/mentions/index.tsx
index c3d2a07a5..71c305427 100644
--- a/components/mentions/index.tsx
+++ b/components/mentions/index.tsx
@@ -10,6 +10,7 @@ import { useInjectFormItemContext } from '../form/FormItemContext';
import omit from '../_util/omit';
import { optionProps, optionOptions } from '../vc-mentions/src/Option';
import type { KeyboardEventHandler } from '../_util/EventInterface';
+import type { CustomSlotsType } from '../_util/type';
interface MentionsConfig {
prefix?: string | string[];
@@ -92,7 +93,11 @@ const Mentions = defineComponent({
name: 'AMentions',
inheritAttrs: false,
props: mentionsProps(),
- slots: ['notFoundContent', 'option'],
+ slots: Object as CustomSlotsType<{
+ notFoundContent?: any;
+ option?: any;
+ default?: any;
+ }>,
setup(props, { slots, emit, attrs, expose }) {
const { prefixCls, renderEmpty, direction } = useConfigInject('mentions', props);
const focused = ref(false);
diff --git a/components/menu/src/ItemGroup.tsx b/components/menu/src/ItemGroup.tsx
index 875decd58..2e056b369 100644
--- a/components/menu/src/ItemGroup.tsx
+++ b/components/menu/src/ItemGroup.tsx
@@ -4,6 +4,7 @@ import { computed, defineComponent } from 'vue';
import PropTypes from '../../_util/vue-types';
import { useInjectMenu } from './hooks/useMenuContext';
import { useMeasure } from './hooks/useKeyPath';
+import type { CustomSlotsType } from '../../_util/type';
export const menuItemGroupProps = () => ({
title: PropTypes.any,
@@ -16,7 +17,10 @@ export default defineComponent({
name: 'AMenuItemGroup',
inheritAttrs: false,
props: menuItemGroupProps(),
- slots: ['title'],
+ slots: Object as CustomSlotsType<{
+ title?: any;
+ default?: any;
+ }>,
setup(props, { slots, attrs }) {
const { prefixCls } = useInjectMenu();
const groupPrefixCls = computed(() => `${prefixCls.value}-item-group`);
diff --git a/components/menu/src/Menu.tsx b/components/menu/src/Menu.tsx
index f695d2653..fb8b84d38 100644
--- a/components/menu/src/Menu.tsx
+++ b/components/menu/src/Menu.tsx
@@ -1,4 +1,4 @@
-import type { Key } from '../../_util/type';
+import type { CustomSlotsType, Key } from '../../_util/type';
import type { ExtractPropTypes, PropType, VNode } from 'vue';
import {
Teleport,
@@ -51,9 +51,9 @@ export const menuProps = () => ({
activeKey: String, // 内部组件使用
selectable: { type: Boolean, default: true },
multiple: { type: Boolean, default: false },
-
+ tabindex: { type: [Number, String] },
motion: Object as PropType,
-
+ role: String,
theme: { type: String as PropType, default: 'light' },
mode: { type: String as PropType, default: 'vertical' },
@@ -88,7 +88,11 @@ export default defineComponent({
name: 'AMenu',
inheritAttrs: false,
props: menuProps(),
- slots: ['expandIcon', 'overflowedIndicator'],
+ slots: Object as CustomSlotsType<{
+ expandIcon?: { isOpen: boolean; [key: string]: any };
+ overflowedIndicator?: any;
+ default: any;
+ }>,
setup(props, { slots, emit, attrs }) {
const { prefixCls, direction, getPrefixCls } = useConfigInject('menu', props);
const store = ref>({});
diff --git a/components/menu/src/MenuItem.tsx b/components/menu/src/MenuItem.tsx
index f8d9cc6a0..75f462d74 100644
--- a/components/menu/src/MenuItem.tsx
+++ b/components/menu/src/MenuItem.tsx
@@ -12,6 +12,7 @@ import useDirectionStyle from './hooks/useDirectionStyle';
import Overflow from '../../vc-overflow';
import devWarning from '../../vc-util/devWarning';
import type { MouseEventHandler } from '../../_util/EventInterface';
+import type { CustomSlotsType } from '../../_util/type';
let indexGuid = 0;
export const menuItemProps = () => ({
@@ -35,8 +36,12 @@ export default defineComponent({
name: 'AMenuItem',
inheritAttrs: false,
props: menuItemProps(),
- // emits: ['mouseenter', 'mouseleave', 'click', 'keydown', 'focus'],
- slots: ['icon', 'title'],
+ slots: Object as CustomSlotsType<{
+ icon?: any;
+ title?: any;
+ default?: any;
+ }>,
+
setup(props, { slots, emit, attrs }) {
const instance = getCurrentInstance();
const isMeasure = useMeasure();
diff --git a/components/menu/src/PopupTrigger.tsx b/components/menu/src/PopupTrigger.tsx
index 169065162..b55555dc5 100644
--- a/components/menu/src/PopupTrigger.tsx
+++ b/components/menu/src/PopupTrigger.tsx
@@ -7,6 +7,7 @@ import { placements, placementsRtl } from './placements';
import raf from '../../_util/raf';
import classNames from '../../_util/classNames';
import { getTransitionProps } from '../../_util/transition';
+import type { CustomSlotsType } from '../../_util/type';
const popupPlacementMap = {
horizontal: 'bottomLeft',
@@ -28,7 +29,10 @@ export default defineComponent({
disabled: Boolean,
onVisibleChange: Function as PropType<(visible: boolean) => void>,
},
- slots: ['popup'],
+ slots: Object as CustomSlotsType<{
+ default?: any;
+ popup?: any;
+ }>,
emits: ['visibleChange'],
setup(props, { slots, emit }) {
const innerVisible = ref(false);
diff --git a/components/menu/src/SubMenu.tsx b/components/menu/src/SubMenu.tsx
index 8d1ef3318..160ab32a7 100644
--- a/components/menu/src/SubMenu.tsx
+++ b/components/menu/src/SubMenu.tsx
@@ -20,7 +20,7 @@ import Overflow from '../../vc-overflow';
import devWarning from '../../vc-util/devWarning';
import isValid from '../../_util/isValid';
import type { MouseEventHandler } from '../../_util/EventInterface';
-import type { Key } from 'ant-design-vue/es/_util/type';
+import type { CustomSlotsType, Key } from '../../_util/type';
let indexGuid = 0;
@@ -46,8 +46,12 @@ export default defineComponent({
name: 'ASubMenu',
inheritAttrs: false,
props: subMenuProps(),
- slots: ['icon', 'title', 'expandIcon'],
- // emits: ['titleClick', 'mouseenter', 'mouseleave'],
+ slots: Object as CustomSlotsType<{
+ icon?: any;
+ title?: any;
+ expandIcon?: { isOpen: boolean; [key: string]: any };
+ default?: any;
+ }>,
setup(props, { slots, attrs, emit }) {
useProvideFirstLevel(false);
const isMeasure = useMeasure();
diff --git a/components/page-header/index.tsx b/components/page-header/index.tsx
index 4da27e9a5..b945753f0 100644
--- a/components/page-header/index.tsx
+++ b/components/page-header/index.tsx
@@ -8,6 +8,7 @@ import Breadcrumb from '../breadcrumb';
import Avatar from '../avatar';
import TransButton from '../_util/transButton';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
+import type { CustomSlotsType } from '../_util/type';
import { withInstall } from '../_util/type';
import useConfigInject from '../_util/hooks/useConfigInject';
import classNames from '../_util/classNames';
@@ -36,7 +37,17 @@ const PageHeader = defineComponent({
name: 'APageHeader',
props: pageHeaderProps(),
// emits: ['back'],
- slots: ['backIcon', 'avatar', 'breadcrumb', 'title', 'subTitle', 'tags', 'extra', 'footer'],
+ slots: Object as CustomSlotsType<{
+ backIcon: any;
+ avatar: any;
+ breadcrumb: any;
+ title: any;
+ subTitle: any;
+ tags: any;
+ extra: any;
+ footer: any;
+ default: any;
+ }>,
setup(props, { emit, slots }) {
const { prefixCls, direction, pageHeader } = useConfigInject('page-header', props);
const compact = ref(false);
diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx
index 6bbe831f5..40b6cee9d 100644
--- a/components/popconfirm/index.tsx
+++ b/components/popconfirm/index.tsx
@@ -10,6 +10,7 @@ import ExclamationCircleFilled from '@ant-design/icons-vue/ExclamationCircleFill
import Button from '../button';
import { useLocaleReceiver } from '../locale-provider/LocaleReceiver';
import defaultLocale from '../locale-provider/default';
+import type { CustomSlotsType } from '../_util/type';
import { withInstall } from '../_util/type';
import useMergedState from '../_util/hooks/useMergedState';
import devWarning from '../vc-util/devWarning';
@@ -70,7 +71,16 @@ const Popconfirm = defineComponent({
okType: 'primary',
disabled: false,
}),
- slots: ['title', 'content', 'okText', 'icon', 'cancelText', 'cancelButton', 'okButton'],
+ slots: Object as CustomSlotsType<{
+ title?: any;
+ content?: any;
+ okText?: any;
+ icon?: any;
+ cancelText?: any;
+ cancelButton?: any;
+ okButton?: any;
+ default?: any;
+ }>,
emits: ['update:visible', 'visibleChange'],
setup(props: PopconfirmProps, { slots, emit, expose }) {
onMounted(() => {
diff --git a/components/progress/progress.tsx b/components/progress/progress.tsx
index 335c3edeb..8df903f6c 100644
--- a/components/progress/progress.tsx
+++ b/components/progress/progress.tsx
@@ -11,7 +11,7 @@ import { getSuccessPercent, validProgress } from './utils';
import useConfigInject from '../_util/hooks/useConfigInject';
import devWarning from '../vc-util/devWarning';
import { progressProps, progressStatuses } from './props';
-import type { VueNode } from '../_util/type';
+import type { CustomSlotsType, VueNode } from '../_util/type';
export default defineComponent({
compatConfig: { MODE: 3 },
@@ -25,7 +25,10 @@ export default defineComponent({
size: 'default',
strokeLinecap: 'round',
}),
- slots: ['format'],
+ slots: Object as CustomSlotsType<{
+ default?: any;
+ format?: any;
+ }>,
setup(props, { slots }) {
const { prefixCls, direction } = useConfigInject('progress', props);
devWarning(
diff --git a/components/result/index.tsx b/components/result/index.tsx
index b7a0c4cf2..2e4738a55 100644
--- a/components/result/index.tsx
+++ b/components/result/index.tsx
@@ -10,6 +10,7 @@ import serverError from './serverError';
import unauthorized from './unauthorized';
import useConfigInject from '../_util/hooks/useConfigInject';
import classNames from '../_util/classNames';
+import type { CustomSlotsType } from '../_util/type';
export const IconMap = {
success: CheckCircleFilled,
@@ -62,7 +63,13 @@ const Result = defineComponent({
compatConfig: { MODE: 3 },
name: 'AResult',
props: resultProps(),
- slots: ['title', 'subTitle', 'icon', 'extra'],
+ slots: Object as CustomSlotsType<{
+ title?: any;
+ subTitle?: any;
+ icon?: any;
+ extra?: any;
+ dfault?: any;
+ }>,
setup(props, { slots }) {
const { prefixCls, direction } = useConfigInject('result', props);
const className = computed(() =>
diff --git a/components/select/index.tsx b/components/select/index.tsx
index e013d27df..a997322f1 100644
--- a/components/select/index.tsx
+++ b/components/select/index.tsx
@@ -13,6 +13,7 @@ import { useInjectFormItemContext } from '../form/FormItemContext';
import { getTransitionName } from '../_util/transition';
import type { SizeType } from '../config-provider';
import { initDefaultProps } from '../_util/props-util';
+import type { CustomSlotsType } from '../_util/type';
type RawValue = string | number;
@@ -65,20 +66,20 @@ const Select = defineComponent({
listItemHeight: 24,
}),
SECRET_COMBOBOX_MODE_DO_NOT_USE,
- // emits: ['change', 'update:value', 'blur'],
- slots: [
- 'notFoundContent',
- 'suffixIcon',
- 'itemIcon',
- 'removeIcon',
- 'clearIcon',
- 'dropdownRender',
- 'option',
- 'placeholder',
- 'tagRender',
- 'maxTagPlaceholder',
- 'optionLabel', // donot use, maybe remove it
- ],
+ slots: Object as CustomSlotsType<{
+ notFoundContent: any;
+ suffixIcon: any;
+ itemIcon: any;
+ removeIcon: any;
+ clearIcon: any;
+ dropdownRender: any;
+ option: any;
+ placeholder: any;
+ tagRender: any;
+ maxTagPlaceholder: any;
+ optionLabel: any;
+ default: any;
+ }>,
setup(props, { attrs, emit, slots, expose }) {
const selectRef = ref();
const formItemContext = useInjectFormItemContext();
diff --git a/components/slider/index.tsx b/components/slider/index.tsx
index 4d354c7ad..d1a673ce6 100644
--- a/components/slider/index.tsx
+++ b/components/slider/index.tsx
@@ -3,7 +3,7 @@ import { computed, ref, defineComponent } from 'vue';
import VcSlider from '../vc-slider/src/Slider';
import VcRange from '../vc-slider/src/Range';
import VcHandle from '../vc-slider/src/Handle';
-import type { VueNode } from '../_util/type';
+import type { CustomSlotsType, VueNode } from '../_util/type';
import { withInstall } from '../_util/type';
import type { TooltipPlacement } from '../tooltip/Tooltip';
import useConfigInject from '../_util/hooks/useConfigInject';
@@ -83,7 +83,10 @@ const Slider = defineComponent({
inheritAttrs: false,
props: sliderProps(),
// emits: ['update:value', 'change', 'afterChange', 'blur'],
- slots: ['mark'],
+ slots: Object as CustomSlotsType<{
+ mark?: any;
+ default?: any;
+ }>,
setup(props, { attrs, slots, emit, expose }) {
const { prefixCls, rootPrefixCls, direction, getPopupContainer, configProvider } =
useConfigInject('slider', props);
diff --git a/components/space/index.tsx b/components/space/index.tsx
index 055f6469f..82c833b29 100644
--- a/components/space/index.tsx
+++ b/components/space/index.tsx
@@ -3,6 +3,7 @@ import { defineComponent, computed, ref, watch, Fragment } from 'vue';
import PropTypes from '../_util/vue-types';
import { filterEmpty } from '../_util/props-util';
import type { SizeType } from '../config-provider';
+import type { CustomSlotsType } from '../_util/type';
import { tuple, withInstall } from '../_util/type';
import useConfigInject from '../_util/hooks/useConfigInject';
import useFlexGapSupport from '../_util/hooks/useFlexGapSupport';
@@ -34,7 +35,10 @@ const Space = defineComponent({
compatConfig: { MODE: 3 },
name: 'ASpace',
props: spaceProps(),
- slots: ['split'],
+ slots: Object as CustomSlotsType<{
+ split?: any;
+ default?: any;
+ }>,
setup(props, { slots }) {
const { prefixCls, space, direction: directionConfig } = useConfigInject('space', props);
const supportFlexGap = useFlexGapSupport();
diff --git a/components/statistic/Statistic.tsx b/components/statistic/Statistic.tsx
index 30e08ec64..8170692b8 100644
--- a/components/statistic/Statistic.tsx
+++ b/components/statistic/Statistic.tsx
@@ -6,6 +6,7 @@ import StatisticNumber from './Number';
import type { valueType } from './utils';
import Skeleton from '../skeleton/Skeleton';
import useConfigInject from '../_util/hooks/useConfigInject';
+import type { CustomSlotsType } from '../_util/type';
export const statisticProps = () => ({
prefixCls: String,
@@ -35,7 +36,13 @@ export default defineComponent({
groupSeparator: ',',
loading: false,
}),
- slots: ['title', 'prefix', 'suffix', 'formatter'],
+ slots: Object as CustomSlotsType<{
+ title?: any;
+ prefix?: any;
+ suffix?: any;
+ formatter?: any;
+ default?: any;
+ }>,
setup(props, { slots }) {
const { prefixCls, direction } = useConfigInject('statistic', props);
return () => {
diff --git a/components/steps/index.tsx b/components/steps/index.tsx
index dad2b58e7..84e3404c0 100644
--- a/components/steps/index.tsx
+++ b/components/steps/index.tsx
@@ -13,6 +13,7 @@ import omit from '../_util/omit';
import { VcStepProps } from '../vc-steps/Step';
import type { ProgressDotRender } from '../vc-steps/Steps';
import type { MouseEventHandler } from '../_util/EventInterface';
+import type { CustomSlotsType } from '../_util/type';
export const stepsProps = () => ({
prefixCls: String,
@@ -57,7 +58,11 @@ const Steps = defineComponent({
responsive: true,
labelPlacement: 'horizontal',
}),
- slots: ['progressDot'],
+ slots: Object as CustomSlotsType<{
+ progressDot: any;
+ default: any;
+ }>,
+
// emits: ['update:current', 'change'],
setup(props, { attrs, slots, emit }) {
const { prefixCls, direction: rtlDirection, configProvider } = useConfigInject('steps', props);
diff --git a/components/switch/index.tsx b/components/switch/index.tsx
index b0c86a406..04c5ca5a4 100644
--- a/components/switch/index.tsx
+++ b/components/switch/index.tsx
@@ -5,6 +5,7 @@ import PropTypes from '../_util/vue-types';
import KeyCode from '../_util/KeyCode';
import Wave from '../_util/wave';
import warning from '../_util/warning';
+import type { CustomSlotsType } from '../_util/type';
import { tuple, withInstall } from '../_util/type';
import { getPropsSlot } from '../_util/props-util';
import useConfigInject from '../_util/hooks/useConfigInject';
@@ -60,7 +61,11 @@ const Switch = defineComponent({
__ANT_SWITCH: true,
inheritAttrs: false,
props: switchProps(),
- slots: ['checkedChildren', 'unCheckedChildren'],
+ slots: Object as CustomSlotsType<{
+ checkedChildren: any;
+ unCheckedChildren: any;
+ default: any;
+ }>,
// emits: ['update:checked', 'mouseup', 'change', 'click', 'keydown', 'blur'],
setup(props, { attrs, slots, expose, emit }) {
const formItemContext = useInjectFormItemContext();
diff --git a/components/table/Column.tsx b/components/table/Column.tsx
index 588cddedf..6ee9d992e 100644
--- a/components/table/Column.tsx
+++ b/components/table/Column.tsx
@@ -1,10 +1,16 @@
import { defineComponent } from 'vue';
import type { ColumnType } from './interface';
+import type { CustomSlotsType } from '../_util/type';
export type ColumnProps = ColumnType;
export default defineComponent({
name: 'ATableColumn',
- slots: ['title', 'filterIcon'],
+ slots: Object as CustomSlotsType<{
+ title?: any;
+ filterIcon?: any;
+ default?: any;
+ }>,
+
render() {
return null;
},
diff --git a/components/table/ColumnGroup.tsx b/components/table/ColumnGroup.tsx
index b1d03ae0a..7d6b78459 100644
--- a/components/table/ColumnGroup.tsx
+++ b/components/table/ColumnGroup.tsx
@@ -1,9 +1,13 @@
import { defineComponent } from 'vue';
import type { ColumnGroupProps } from '../vc-table/sugar/ColumnGroup';
+import type { CustomSlotsType } from '../_util/type';
export default defineComponent>({
name: 'ATableColumnGroup',
- slots: ['title'],
+ slots: Object as CustomSlotsType<{
+ title?: any;
+ default?: any;
+ }>,
__ANT_TABLE_COLUMN_GROUP: true,
render() {
return null;
diff --git a/components/table/Table.tsx b/components/table/Table.tsx
index 68dec9e8a..a7ec65a35 100644
--- a/components/table/Table.tsx
+++ b/components/table/Table.tsx
@@ -36,7 +36,7 @@ import type { SizeType } from '../config-provider';
import devWarning from '../vc-util/devWarning';
import type { CSSProperties, PropType } from 'vue';
import { nextTick, reactive, ref, computed, defineComponent, toRef, watchEffect, watch } from 'vue';
-import type { DefaultRecordType } from '../vc-table/interface';
+import type { DefaultRecordType, RenderExpandIconProps } from '../vc-table/interface';
import useBreakpoint from '../_util/hooks/useBreakpoint';
import useConfigInject from '../_util/hooks/useConfigInject';
import { useLocaleReceiver } from '../locale-provider/LocaleReceiver';
@@ -47,6 +47,7 @@ import { useProvideSlots, useProvideTableContext } from './context';
import type { ContextSlots } from './context';
import useColumns from './hooks/useColumns';
import { convertChildrenToColumns } from './util';
+import type { CustomSlotsType } from '../_util/type';
export type { ColumnsType, TablePaginationConfig };
@@ -242,19 +243,19 @@ const InteralTable = defineComponent<
props: initDefaultProps(tableProps(), {
rowKey: 'key',
}) as any,
- // emits: ['expandedRowsChange', 'change', 'expand'],
- slots: [
- 'emptyText',
- 'expandIcon',
- 'title',
- 'footer',
- 'summary',
- 'expandedRowRender',
- 'bodyCell',
- 'headerCell',
- 'customFilterIcon',
- 'customFilterDropdown',
- ],
+ slots: Object as CustomSlotsType<{
+ emptyText?: any;
+ expandIcon?: RenderExpandIconProps;
+ title?: any;
+ footer?: any;
+ summary?: any;
+ expandedRowRender?: any;
+ bodyCell?: any;
+ headerCell?: any;
+ customFilterIcon?: any;
+ customFilterDropdown?: any;
+ default: any;
+ }>,
setup(props, { attrs, slots, expose, emit }) {
devWarning(
!(typeof props.rowKey === 'function' && props.rowKey.length > 1),
diff --git a/components/tabs/src/TabNavList/OperationNode.tsx b/components/tabs/src/TabNavList/OperationNode.tsx
index 22ec38af1..b23b4d4b8 100644
--- a/components/tabs/src/TabNavList/OperationNode.tsx
+++ b/components/tabs/src/TabNavList/OperationNode.tsx
@@ -2,7 +2,7 @@ import Menu, { MenuItem } from '../../../menu';
import Dropdown from '../../../vc-dropdown';
import type { Tab, TabsLocale, EditableConfig } from '../interface';
import AddButton from './AddButton';
-import type { Key } from '../../../_util/type';
+import type { CustomSlotsType, Key } from '../../../_util/type';
import KeyCode from '../../../_util/KeyCode';
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
import classNames from '../../../_util/classNames';
@@ -35,7 +35,10 @@ export default defineComponent({
inheritAttrs: false,
props: operationNodeProps,
emits: ['tabClick'],
- slots: ['moreIcon'],
+ slots: Object as CustomSlotsType<{
+ moreIcon?: any;
+ default?: any;
+ }>,
setup(props, { attrs, slots }) {
// ======================== Dropdown ========================
const [open, setOpen] = useState(false);
diff --git a/components/tabs/src/TabNavList/index.tsx b/components/tabs/src/TabNavList/index.tsx
index e21568218..9f713a06f 100644
--- a/components/tabs/src/TabNavList/index.tsx
+++ b/components/tabs/src/TabNavList/index.tsx
@@ -16,7 +16,7 @@ import OperationNode from './OperationNode';
import { useInjectTabs } from '../TabContext';
import useTouchMove from '../hooks/useTouchMove';
import AddButton from './AddButton';
-import type { Key } from '../../../_util/type';
+import type { CustomSlotsType, Key } from '../../../_util/type';
import type { ExtractPropTypes, PropType, CSSProperties } from 'vue';
import { onBeforeUnmount, defineComponent, ref, watch, watchEffect, computed } from 'vue';
import PropTypes from '../../../_util/vue-types';
@@ -64,7 +64,13 @@ export default defineComponent({
name: 'TabNavList',
inheritAttrs: false,
props: tabNavListProps(),
- slots: ['moreIcon', 'leftExtra', 'rightExtra', 'tabBarExtraContent'],
+ slots: Object as CustomSlotsType<{
+ moreIcon?: any;
+ leftExtra?: any;
+ rightExtra?: any;
+ tabBarExtraContent?: any;
+ default?: any;
+ }>,
emits: ['tabClick', 'tabScroll'],
setup(props, { attrs, slots }) {
const { tabs, prefixCls } = useInjectTabs();
diff --git a/components/tabs/src/TabPanelList/TabPane.tsx b/components/tabs/src/TabPanelList/TabPane.tsx
index 34afe68e4..ff8cdbc28 100644
--- a/components/tabs/src/TabPanelList/TabPane.tsx
+++ b/components/tabs/src/TabPanelList/TabPane.tsx
@@ -1,6 +1,7 @@
import { defineComponent, ref, watch, computed } from 'vue';
import type { CSSProperties, ExtractPropTypes } from 'vue';
import PropTypes from '../../../_util/vue-types';
+import type { CustomSlotsType } from '../../../_util/type';
const tabPaneProps = () => ({
tab: PropTypes.any,
@@ -26,7 +27,11 @@ export default defineComponent({
inheritAttrs: false,
__ANT_TAB_PANE: true,
props: tabPaneProps(),
- slots: ['closeIcon', 'tab'],
+ slots: Object as CustomSlotsType<{
+ closeIcon: any;
+ tab: any;
+ default: any;
+ }>,
setup(props, { attrs, slots }) {
const visited = ref(props.forceRender);
watch(
diff --git a/components/tabs/src/Tabs.tsx b/components/tabs/src/Tabs.tsx
index 2a16924ed..5768927b9 100644
--- a/components/tabs/src/Tabs.tsx
+++ b/components/tabs/src/Tabs.tsx
@@ -23,7 +23,7 @@ import PlusOutlined from '@ant-design/icons-vue/PlusOutlined';
import devWarning from '../../vc-util/devWarning';
import type { SizeType } from '../../config-provider';
import { useProvideTabs } from './TabContext';
-import type { Key } from '../../_util/type';
+import type { CustomSlotsType, Key } from '../../_util/type';
import pick from 'lodash-es/pick';
import PropTypes from '../../_util/vue-types';
import type { MouseEventHandler } from '../../_util/EventInterface';
@@ -128,15 +128,16 @@ const InternalTabs = defineComponent({
}),
tabs: { type: Array as PropType },
},
- slots: [
- 'tabBarExtraContent',
- 'leftExtra',
- 'rightExtra',
- 'moreIcon',
- 'addIcon',
- 'removeIcon',
- 'renderTabBar',
- ],
+ slots: Object as CustomSlotsType<{
+ tabBarExtraContent?: any;
+ leftExtra?: any;
+ rightExtra?: any;
+ moreIcon?: any;
+ addIcon?: any;
+ removeIcon?: any;
+ renderTabBar?: any;
+ default: any;
+ }>,
// emits: ['tabClick', 'tabScroll', 'change', 'update:activeKey'],
setup(props, { attrs, slots }) {
devWarning(
@@ -339,15 +340,16 @@ export default defineComponent({
tabPane: false,
},
}),
- slots: [
- 'tabBarExtraContent',
- 'leftExtra',
- 'rightExtra',
- 'moreIcon',
- 'addIcon',
- 'removeIcon',
- 'renderTabBar',
- ],
+ slots: Object as CustomSlotsType<{
+ tabBarExtraContent?: any;
+ leftExtra?: any;
+ rightExtra?: any;
+ moreIcon?: any;
+ addIcon?: any;
+ removeIcon?: any;
+ renderTabBar?: any;
+ default?: any;
+ }>,
// emits: ['tabClick', 'tabScroll', 'change', 'update:activeKey'],
setup(props, { attrs, slots, emit }) {
const handleChange = (key: string) => {
diff --git a/components/tag/index.tsx b/components/tag/index.tsx
index 7ad896a99..f94cf7d51 100644
--- a/components/tag/index.tsx
+++ b/components/tag/index.tsx
@@ -6,7 +6,7 @@ import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
import Wave from '../_util/wave';
import type { PresetColorType, PresetStatusColorType } from '../_util/colors';
import { PresetColorTypes, PresetStatusColorTypes } from '../_util/colors';
-import type { LiteralUnion } from '../_util/type';
+import type { CustomSlotsType, LiteralUnion } from '../_util/type';
import CheckableTag from './CheckableTag';
import useConfigInject from '../_util/hooks/useConfigInject';
@@ -35,7 +35,11 @@ const Tag = defineComponent({
name: 'ATag',
props: tagProps(),
// emits: ['update:visible', 'close'],
- slots: ['closeIcon', 'icon'],
+ slots: Object as CustomSlotsType<{
+ closeIcon: any;
+ icon: any;
+ default: any;
+ }>,
setup(props: TagProps, { slots, emit, attrs }) {
const { prefixCls, direction } = useConfigInject('tag', props);
diff --git a/components/time-picker/time-picker.tsx b/components/time-picker/time-picker.tsx
index af363046d..8179f6168 100644
--- a/components/time-picker/time-picker.tsx
+++ b/components/time-picker/time-picker.tsx
@@ -13,6 +13,7 @@ import type { RangePickerSharedProps } from '../vc-picker/RangePicker';
import devWarning from '../vc-util/devWarning';
import { useInjectFormItemContext } from '../form/FormItemContext';
import omit from '../_util/omit';
+import type { CustomSlotsType } from '../_util/type';
export interface TimePickerLocale {
placeholder?: string;
@@ -93,7 +94,13 @@ function createTimePicker<
...timePickerProps(),
addon: { type: Function },
} as any,
- slot: ['addon', 'renderExtraFooter', 'suffixIcon', 'clearIcon'],
+ slots: Object as CustomSlotsType<{
+ addon?: any;
+ renderExtraFooter?: any;
+ suffixIcon?: any;
+ clearIcon?: any;
+ default: any;
+ }>,
setup(props, { slots, expose, emit, attrs }) {
const formItemContext = useInjectFormItemContext();
devWarning(
@@ -164,7 +171,12 @@ function createTimePicker<
...timePickerProps(),
order: { type: Boolean, default: true },
} as any,
- slot: ['renderExtraFooter', 'suffixIcon', 'clearIcon'],
+ slots: Object as CustomSlotsType<{
+ renderExtraFooter?: any;
+ suffixIcon?: any;
+ clearIcon?: any;
+ default: any;
+ }>,
setup(props, { slots, expose, emit, attrs }) {
const pickerRef = ref();
const formItemContext = useInjectFormItemContext();
diff --git a/components/timeline/Timeline.tsx b/components/timeline/Timeline.tsx
index e8e8b0924..2bbeab96b 100644
--- a/components/timeline/Timeline.tsx
+++ b/components/timeline/Timeline.tsx
@@ -6,6 +6,7 @@ import { filterEmpty } from '../_util/props-util';
import initDefaultProps from '../_util/props-util/initDefaultProps';
import TimelineItem from './TimelineItem';
import LoadingOutlined from '@ant-design/icons-vue/LoadingOutlined';
+import type { CustomSlotsType } from '../_util/type';
import { tuple } from '../_util/type';
import useConfigInject from '../_util/hooks/useConfigInject';
@@ -27,7 +28,11 @@ export default defineComponent({
reverse: false,
mode: '',
}),
- slots: ['pending', 'pendingDot'],
+ slots: Object as CustomSlotsType<{
+ pending?: any;
+ pendingDot?: any;
+ default?: any;
+ }>,
setup(props, { slots }) {
const { prefixCls, direction } = useConfigInject('timeline', props);
const getPositionCls = (ele, idx: number) => {
diff --git a/components/timeline/TimelineItem.tsx b/components/timeline/TimelineItem.tsx
index 2564e7f43..7e05529d4 100644
--- a/components/timeline/TimelineItem.tsx
+++ b/components/timeline/TimelineItem.tsx
@@ -3,6 +3,7 @@ import { defineComponent } from 'vue';
import classNames from '../_util/classNames';
import PropTypes from '../_util/vue-types';
import initDefaultProps from '../_util/props-util/initDefaultProps';
+import type { CustomSlotsType } from '../_util/type';
import { tuple } from '../_util/type';
import useConfigInject from '../_util/hooks/useConfigInject';
@@ -24,7 +25,11 @@ export default defineComponent({
color: 'blue',
pending: false,
}),
- slots: ['dot', 'label'],
+ slots: Object as CustomSlotsType<{
+ dot?: any;
+ label?: any;
+ default?: any;
+ }>,
setup(props, { slots }) {
const { prefixCls } = useConfigInject('timeline', props);
return () => {
diff --git a/components/tooltip/Tooltip.tsx b/components/tooltip/Tooltip.tsx
index 55b198f1a..00d7a20d1 100644
--- a/components/tooltip/Tooltip.tsx
+++ b/components/tooltip/Tooltip.tsx
@@ -13,6 +13,7 @@ import useConfigInject from '../_util/hooks/useConfigInject';
import getPlacements from './placements';
import firstNotUndefined from '../_util/firstNotUndefined';
import raf from '../_util/raf';
+import type { CustomSlotsType } from '../_util/type';
export type { AdjustOverflow, PlacementsConfig } from './placements';
// https://github.com/react-component/tooltip
@@ -73,7 +74,10 @@ export default defineComponent({
arrowPointAtCenter: false,
autoAdjustOverflow: true,
}),
- slots: ['title'],
+ slots: Object as CustomSlotsType<{
+ title?: any;
+ default?: any;
+ }>,
// emits: ['update:visible', 'visibleChange'],
setup(props, { slots, emit, attrs, expose }) {
const { prefixCls, getPopupContainer } = useConfigInject('tooltip', props);
diff --git a/components/transfer/index.tsx b/components/transfer/index.tsx
index 786bf10c6..f2c336b6e 100644
--- a/components/transfer/index.tsx
+++ b/components/transfer/index.tsx
@@ -7,7 +7,7 @@ import List from './list';
import Operation from './operation';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import defaultLocale from '../locale-provider/default';
-import type { VueNode } from '../_util/type';
+import type { CustomSlotsType, VueNode } from '../_util/type';
import { withInstall } from '../_util/type';
import useConfigInject from '../_util/hooks/useConfigInject';
import type { TransferListBodyProps } from './ListBody';
@@ -109,16 +109,17 @@ const Transfer = defineComponent({
name: 'ATransfer',
inheritAttrs: false,
props: transferProps(),
- slots: [
- 'leftTitle',
- 'rightTitle',
- 'children',
- 'render',
- 'notFoundContent',
- 'leftSelectAllLabel',
- 'rightSelectAllLabel',
- 'footer',
- ],
+ slots: Object as CustomSlotsType<{
+ leftTitle?: any;
+ rightTitle?: any;
+ children?: any;
+ render?: TransferItem;
+ notFoundContent?: any;
+ leftSelectAllLabel?: any;
+ rightSelectAllLabel?: any;
+ footer?: any;
+ default?: any;
+ }>,
// emits: ['update:targetKeys', 'update:selectedKeys', 'change', 'search', 'scroll', 'selectChange'],
setup(props, { emit, attrs, slots, expose }) {
const { configProvider, prefixCls, direction } = useConfigInject('transfer', props);
diff --git a/components/transfer/list.tsx b/components/transfer/list.tsx
index 2a75f6249..78cb8d409 100644
--- a/components/transfer/list.tsx
+++ b/components/transfer/list.tsx
@@ -11,6 +11,7 @@ import type { VNode, VNodeTypes, ExtractPropTypes, PropType, CSSProperties } fro
import { watchEffect, computed, defineComponent, ref } from 'vue';
import type { RadioChangeEvent } from '../radio/interface';
import type { TransferDirection, TransferItem } from './index';
+import type { CustomSlotsType } from '../_util/type';
const defaultRender = () => null;
@@ -67,7 +68,11 @@ export default defineComponent({
inheritAttrs: false,
props: transferListProps,
// emits: ['scroll', 'itemSelectAll', 'itemRemove', 'itemSelect'],
- slots: ['footer', 'titleText'],
+ slots: Object as CustomSlotsType<{
+ footer?: any;
+ titleText?: any;
+ default?: any;
+ }>,
setup(props, { attrs, slots }) {
const filterValue = ref('');
const transferNode = ref();
diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx
index b61489e4c..7d6dd9946 100644
--- a/components/tree-select/index.tsx
+++ b/components/tree-select/index.tsx
@@ -24,6 +24,7 @@ import { useInjectFormItemContext } from '../form/FormItemContext';
import type { BaseSelectRef } from '../vc-select';
import type { BaseOptionType, DefaultOptionType } from '../vc-tree-select/TreeSelect';
import type { TreeProps } from '../tree';
+import type { CustomSlotsType } from '../_util/type';
const getTransitionName = (rootPrefixCls: string, motion: string, transitionName?: string) => {
if (transitionName !== undefined) {
@@ -80,15 +81,16 @@ const TreeSelect = defineComponent({
listItemHeight: 26,
bordered: true,
}),
- slots: [
- 'title',
- 'titleRender',
- 'placeholder',
- 'maxTagPlaceholder',
- 'treeIcon',
- 'switcherIcon',
- 'notFoundContent',
- ],
+ slots: Object as CustomSlotsType<{
+ title?: any;
+ titleRender?: any;
+ placeholder?: any;
+ maxTagPlaceholder?: any;
+ treeIcon?: any;
+ switcherIcon?: any;
+ notFoundContent?: any;
+ default?: any;
+ }>,
setup(props, { attrs, slots, expose, emit }) {
warning(
!(props.treeData === undefined && slots.default),
diff --git a/components/tree/DirectoryTree.tsx b/components/tree/DirectoryTree.tsx
index 64b9ed965..756426a48 100644
--- a/components/tree/DirectoryTree.tsx
+++ b/components/tree/DirectoryTree.tsx
@@ -18,6 +18,7 @@ import { conductExpandParent } from '../vc-tree/util';
import { calcRangeKeys, convertDirectoryKeysToNodes } from './utils/dictUtil';
import useConfigInject from '../_util/hooks/useConfigInject';
import { filterEmpty } from '../_util/props-util';
+import type { CustomSlotsType } from '../_util/type';
export type ExpandAction = false | 'click' | 'doubleclick' | 'dblclick';
@@ -44,7 +45,14 @@ export default defineComponent({
showIcon: true,
expandAction: 'click',
}),
- slots: ['icon', 'title', 'switcherIcon', 'titleRender'],
+ slots: Object as CustomSlotsType<{
+ icon?: any;
+ title?: any;
+ switcherIcon?: any;
+ titleRender?: any;
+ default?: any;
+ }>,
+
// emits: [
// 'update:selectedKeys',
// 'update:checkedKeys',
diff --git a/components/tree/Tree.tsx b/components/tree/Tree.tsx
index 9f2fb6d06..1efd1b65f 100644
--- a/components/tree/Tree.tsx
+++ b/components/tree/Tree.tsx
@@ -15,6 +15,7 @@ import dropIndicatorRender from './utils/dropIndicator';
import devWarning from '../vc-util/devWarning';
import { warning } from '../vc-util/warning';
import omit from '../_util/omit';
+import type { CustomSlotsType } from '../_util/type';
export interface AntdTreeNodeAttribute {
eventKey: string;
@@ -151,17 +152,14 @@ export default defineComponent({
showIcon: false,
blockNode: false,
}),
- slots: ['icon', 'title', 'switcherIcon', 'titleRender'],
- // emits: [
- // 'update:selectedKeys',
- // 'update:checkedKeys',
- // 'update:expandedKeys',
- // 'expand',
- // 'select',
- // 'check',
- // 'doubleclick',
- // 'dblclick',
- // ],
+
+ slots: Object as CustomSlotsType<{
+ icon?: any;
+ title?: any;
+ switcherIcon?: any;
+ titleRender?: any;
+ default?: any;
+ }>,
setup(props, { attrs, expose, emit, slots }) {
warning(
!(props.treeData === undefined && slots.default),
diff --git a/components/vc-overflow/RawItem.tsx b/components/vc-overflow/RawItem.tsx
index 309badbe2..3d26424c9 100644
--- a/components/vc-overflow/RawItem.tsx
+++ b/components/vc-overflow/RawItem.tsx
@@ -17,6 +17,8 @@ export default defineComponent({
onClick: { type: Function },
onKeydown: { type: Function },
onFocus: { type: Function },
+ role: String,
+ tabindex: Number,
},
setup(props, { slots, attrs }) {
const context = useInjectOverflowContext();
From 144bb2e6d5d73885dd447dc7702d7921a884b3b1 Mon Sep 17 00:00:00 2001
From: tangjinzhou <415800467@qq.com>
Date: Thu, 18 May 2023 22:53:21 +0800
Subject: [PATCH 6/6] feat: support vue 3.3 slot type
---
components/auto-complete/index.tsx | 2 +-
components/calendar/demo/customize-header.vue | 2 +-
components/calendar/generateCalendar.tsx | 58 ++++++++++-------
components/popconfirm/index.tsx | 1 +
components/result/index.tsx | 2 +-
components/table/Table.tsx | 64 +++++++++++--------
components/time-picker/time-picker.tsx | 14 ++--
components/typography/Typography.tsx | 7 +-
package.json | 2 -
9 files changed, 90 insertions(+), 62 deletions(-)
diff --git a/components/auto-complete/index.tsx b/components/auto-complete/index.tsx
index f78f1bd2e..276de9679 100644
--- a/components/auto-complete/index.tsx
+++ b/components/auto-complete/index.tsx
@@ -46,7 +46,7 @@ const AutoComplete = defineComponent({
props: autoCompleteProps(),
// emits: ['change', 'select', 'focus', 'blur'],
slots: Object as CustomSlotsType<{
- option: any;
+ options: any;
default: any;
notFoundContent: any;
dataSource: any;
diff --git a/components/calendar/demo/customize-header.vue b/components/calendar/demo/customize-header.vue
index 5cae0c869..eb460a0e1 100644
--- a/components/calendar/demo/customize-header.vue
+++ b/components/calendar/demo/customize-header.vue
@@ -37,7 +37,7 @@ Customize Calendar header content.
:value="String(current.year())"
@change="
newYear => {
- onChange(current.year(newYear));
+ onChange(current.year(+newYear));
}
"
>
diff --git a/components/calendar/generateCalendar.tsx b/components/calendar/generateCalendar.tsx
index 6b6717f71..c3a866da6 100644
--- a/components/calendar/generateCalendar.tsx
+++ b/components/calendar/generateCalendar.tsx
@@ -12,7 +12,7 @@ import { useLocaleReceiver } from '../locale-provider/LocaleReceiver';
import enUS from './locale/en_US';
import CalendarHeader from './Header';
import type { CustomSlotsType, VueNode } from '../_util/type';
-import type { App } from 'vue';
+import type { App, PropType } from 'vue';
import { computed, defineComponent, toRef } from 'vue';
import useConfigInject from '../_util/hooks/useConfigInject';
import classNames from '../_util/classNames';
@@ -86,28 +86,41 @@ function generateCalendar<
);
}
- const Calendar = defineComponent({
+ const Calendar = defineComponent({
name: 'ACalendar',
inheritAttrs: false,
- props: [
- 'prefixCls',
- 'locale',
- 'validRange',
- 'disabledDate',
- 'dateFullCellRender',
- 'dateCellRender',
- 'monthFullCellRender',
- 'monthCellRender',
- 'headerRender',
- 'value',
- 'defaultValue',
- 'mode',
- 'fullscreen',
- 'onChange',
- 'onPanelChange',
- 'onSelect',
- 'valueFormat',
- ] as any,
+ props: {
+ prefixCls: String,
+ locale: { type: Object as PropType, default: undefined as Props['locale'] },
+ validRange: { type: Array as PropType, default: undefined },
+ disabledDate: { type: Function as PropType, default: undefined },
+ dateFullCellRender: {
+ type: Function as PropType,
+ default: undefined,
+ },
+ dateCellRender: { type: Function as PropType, default: undefined },
+ monthFullCellRender: {
+ type: Function as PropType,
+ default: undefined,
+ },
+ monthCellRender: { type: Function as PropType, default: undefined },
+ headerRender: { type: Function as PropType, default: undefined },
+ value: {
+ type: [Object, String] as PropType,
+ default: undefined as Props['value'],
+ },
+ defaultValue: {
+ type: [Object, String] as PropType,
+ default: undefined as Props['defaultValue'],
+ },
+ mode: { type: String as PropType, default: undefined },
+ fullscreen: { type: Boolean as PropType, default: undefined },
+ onChange: { type: Function as PropType, default: undefined },
+ 'onUpdate:value': { type: Function as PropType, default: undefined },
+ onPanelChange: { type: Function as PropType, default: undefined },
+ onSelect: { type: Function as PropType, default: undefined },
+ valueFormat: { type: String, default: undefined },
+ },
slots: Object as CustomSlotsType<{
dateFullCellRender?: { current: DateType };
dateCellRender?: { current: DateType };
@@ -121,7 +134,8 @@ function generateCalendar<
};
default: any;
}>,
- setup(props, { emit, slots, attrs }) {
+ setup(p, { emit, slots, attrs }) {
+ const props = p as unknown as Props;
const { prefixCls, direction } = useConfigInject('picker', props);
const calendarPrefixCls = computed(() => `${prefixCls.value}-calendar`);
const maybeToString = (date: DateType) => {
diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx
index 40b6cee9d..bdda1b910 100644
--- a/components/popconfirm/index.tsx
+++ b/components/popconfirm/index.tsx
@@ -76,6 +76,7 @@ const Popconfirm = defineComponent({
content?: any;
okText?: any;
icon?: any;
+ cancel?: any;
cancelText?: any;
cancelButton?: any;
okButton?: any;
diff --git a/components/result/index.tsx b/components/result/index.tsx
index 2e4738a55..835130546 100644
--- a/components/result/index.tsx
+++ b/components/result/index.tsx
@@ -68,7 +68,7 @@ const Result = defineComponent({
subTitle?: any;
icon?: any;
extra?: any;
- dfault?: any;
+ default?: any;
}>,
setup(props, { slots }) {
const { prefixCls, direction } = useConfigInject('result', props);
diff --git a/components/table/Table.tsx b/components/table/Table.tsx
index a7ec65a35..4e38051ef 100644
--- a/components/table/Table.tsx
+++ b/components/table/Table.tsx
@@ -224,38 +224,27 @@ export const tableProps = () => {
type: [Boolean, Object] as PropType,
default: true,
},
- contextSlots: {
- type: Object as PropType,
- },
+
transformCellText: {
type: Function as PropType,
},
};
};
-const InteralTable = defineComponent<
- TableProps & {
- contextSlots: ContextSlots;
- }
->({
+const InteralTable = defineComponent({
name: 'InteralTable',
inheritAttrs: false,
- props: initDefaultProps(tableProps(), {
- rowKey: 'key',
- }) as any,
- slots: Object as CustomSlotsType<{
- emptyText?: any;
- expandIcon?: RenderExpandIconProps;
- title?: any;
- footer?: any;
- summary?: any;
- expandedRowRender?: any;
- bodyCell?: any;
- headerCell?: any;
- customFilterIcon?: any;
- customFilterDropdown?: any;
- default: any;
- }>,
+ props: initDefaultProps(
+ {
+ ...tableProps(),
+ contextSlots: {
+ type: Object as PropType,
+ },
+ },
+ {
+ rowKey: 'key',
+ },
+ ),
setup(props, { attrs, slots, expose, emit }) {
devWarning(
!(typeof props.rowKey === 'function' && props.rowKey.length > 1),
@@ -684,9 +673,34 @@ const InteralTable = defineComponent<
},
});
-const Table = defineComponent({
+const Table = defineComponent({
name: 'ATable',
inheritAttrs: false,
+ props: initDefaultProps(tableProps(), {
+ rowKey: 'key',
+ }),
+ slots: Object as CustomSlotsType<{
+ emptyText?: any;
+ expandIcon?: RenderExpandIconProps;
+ title?: any;
+ footer?: any;
+ summary?: any;
+ expandedRowRender?: any;
+ bodyCell?: {
+ text: any;
+ value: any;
+ record: Record;
+ index: number;
+ column: ColumnType;
+ };
+ headerCell?: {
+ title: any;
+ column: ColumnType;
+ };
+ customFilterIcon?: any;
+ customFilterDropdown?: any;
+ default: any;
+ }>,
setup(_props, { attrs, slots, expose }) {
const table = ref();
expose({
diff --git a/components/time-picker/time-picker.tsx b/components/time-picker/time-picker.tsx
index 8179f6168..33c735247 100644
--- a/components/time-picker/time-picker.tsx
+++ b/components/time-picker/time-picker.tsx
@@ -85,7 +85,7 @@ function createTimePicker<
});
const { TimePicker: InternalTimePicker, RangePicker: InternalRangePicker } = DatePicker as any;
- const TimePicker = defineComponent({
+ const TimePicker = defineComponent({
name: 'ATimePicker',
inheritAttrs: false,
props: {
@@ -93,7 +93,7 @@ function createTimePicker<
...datePickerProps(),
...timePickerProps(),
addon: { type: Function },
- } as any,
+ },
slots: Object as CustomSlotsType<{
addon?: any;
renderExtraFooter?: any;
@@ -101,7 +101,8 @@ function createTimePicker<
clearIcon?: any;
default: any;
}>,
- setup(props, { slots, expose, emit, attrs }) {
+ setup(p, { slots, expose, emit, attrs }) {
+ const props = p as unknown as DTimePickerProps;
const formItemContext = useInjectFormItemContext();
devWarning(
!(slots.addon || props.addon),
@@ -162,7 +163,7 @@ function createTimePicker<
},
});
- const TimeRangePicker = defineComponent({
+ const TimeRangePicker = defineComponent({
name: 'ATimeRangePicker',
inheritAttrs: false,
props: {
@@ -170,14 +171,15 @@ function createTimePicker<
...rangePickerProps(),
...timePickerProps(),
order: { type: Boolean, default: true },
- } as any,
+ },
slots: Object as CustomSlotsType<{
renderExtraFooter?: any;
suffixIcon?: any;
clearIcon?: any;
default: any;
}>,
- setup(props, { slots, expose, emit, attrs }) {
+ setup(p, { slots, expose, emit, attrs }) {
+ const props = p as unknown as DTimeRangePickerProps;
const pickerRef = ref();
const formItemContext = useInjectFormItemContext();
expose({
diff --git a/components/typography/Typography.tsx b/components/typography/Typography.tsx
index a0797e35c..e5a32571b 100644
--- a/components/typography/Typography.tsx
+++ b/components/typography/Typography.tsx
@@ -18,28 +18,27 @@ export const typographyProps = () => ({
// Form Internal use
component: String,
});
-const Typography = defineComponent({
+const Typography = defineComponent({
name: 'ATypography',
inheritAttrs: false,
- props: typographyProps() as any,
+ props: typographyProps(),
setup(props, { slots, attrs }) {
const { prefixCls, direction } = useConfigInject('typography', props);
return () => {
const {
prefixCls: _prefixCls,
- class: _className,
direction: _direction,
component: Component = 'article' as any,
...restProps
} = { ...props, ...attrs };
return (
{slots.default?.()}
diff --git a/package.json b/package.json
index 4945f762e..a3238eb36 100644
--- a/package.json
+++ b/package.json
@@ -251,7 +251,6 @@
"url-loader": "^3.0.0",
"vite": "^3.0.0",
"vue": "^3.2.0",
- "vue-antd-md-loader": "^1.2.1-beta.1",
"vue-clipboard2": "0.3.3",
"vue-drag-resize": "^2.0.3",
"vue-eslint-parser": "^8.0.0",
@@ -260,7 +259,6 @@
"vue-loader": "^17.0.0",
"vue-request": "^1.0.2",
"vue-router": "^4.0.0",
- "vue-server-renderer": "^2.6.11",
"vue-style-loader": "^4.1.2",
"vue-tsc": "^1.0.6",
"vuex": "^4.0.0",