feat: support vue 3.3 slot type

pull/6584/head
tangjinzhou 2023-05-18 21:22:58 +08:00
parent 9499a7fc86
commit b4258dc23d
59 changed files with 452 additions and 181 deletions

View File

@ -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 }) {

View File

@ -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 }) {

View File

@ -41,7 +41,7 @@ export default defineComponent({
inheritAttrs: false,
props: badgeProps(),
slots: Object as CustomSlotsType<{
text: BadgeProps;
text: any;
count: any;
default: any;
}>,

View File

@ -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;
}>,

View File

@ -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);
/**

View File

@ -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`);

View File

@ -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[]) => {

View File

@ -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 () => {

View File

@ -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<Key[]>(
getActiveKeysArray(firstNotUndefined([props.activeKey, props.defaultActiveKey])),

View File

@ -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<ExtractPropTypes<ReturnType<typeof collapsePanelProps>>>;
@ -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(

View File

@ -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?.();

View File

@ -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<DateType, ExtraProps = {}>(
generateConfig: GenerateConfig<DateType>,
@ -32,18 +33,18 @@ export default function generateRangePicker<DateType, ExtraProps = {}>(
...rangePickerProps<DateType>(),
...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<DateType> & RangePickerProps<DateType>;
const formItemContext = useInjectFormItemContext();

View File

@ -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<DateType, ExtraProps = {}>(
generateConfig: GenerateConfig<DateType>,
@ -32,18 +33,19 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
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<DateType> &
@ -154,7 +156,7 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
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 = {};

View File

@ -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);

View File

@ -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);

View File

@ -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<ExtractPropTypes<ReturnType<typeof dropdownButtonProps>>>;
@ -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);

View File

@ -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<ExtractPropTypes<ReturnType<typeof dropdownProps>>>;
@ -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',

View File

@ -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}`;

View File

@ -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',

View File

@ -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);

View File

@ -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<HTMLInputElement>();
const focus = ref(false);

View File

@ -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();

View File

@ -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(),

View File

@ -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 () => {

View File

@ -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'),

View File

@ -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);

View File

@ -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`);

View File

@ -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<CSSMotionProps>,
role: String,
theme: { type: String as PropType<MenuTheme>, default: 'light' },
mode: { type: String as PropType<MenuMode>, 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<Record<string, StoreMenuInfo>>({});

View File

@ -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();

View File

@ -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);

View File

@ -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();

View File

@ -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);

View File

@ -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(() => {

View File

@ -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(

View File

@ -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(() =>

View File

@ -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<BaseSelectRef>();
const formItemContext = useInjectFormItemContext();

View File

@ -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);

View File

@ -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();

View File

@ -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 () => {

View File

@ -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);

View File

@ -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();

View File

@ -1,10 +1,16 @@
import { defineComponent } from 'vue';
import type { ColumnType } from './interface';
import type { CustomSlotsType } from '../_util/type';
export type ColumnProps<RecordType = unknown> = ColumnType<RecordType>;
export default defineComponent<ColumnProps>({
name: 'ATableColumn',
slots: ['title', 'filterIcon'],
slots: Object as CustomSlotsType<{
title?: any;
filterIcon?: any;
default?: any;
}>,
render() {
return null;
},

View File

@ -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<ColumnGroupProps<any>>({
name: 'ATableColumnGroup',
slots: ['title'],
slots: Object as CustomSlotsType<{
title?: any;
default?: any;
}>,
__ANT_TABLE_COLUMN_GROUP: true,
render() {
return null;

View File

@ -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<any>;
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),

View File

@ -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);

View File

@ -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();

View File

@ -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(

View File

@ -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<Tab[]> },
},
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) => {

View File

@ -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);

View File

@ -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();

View File

@ -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) => {

View File

@ -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 () => {

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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),

View File

@ -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',

View File

@ -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),

View File

@ -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();