Merge remote-tracking branch 'origin/main' into feat-v4

This commit is contained in:
tangjinzhou 2023-05-18 23:23:43 +08:00
commit 03760e3e3d
88 changed files with 598 additions and 272 deletions

View File

@ -1,4 +1,4 @@
const { resolve } = require('./utils/projectHelper');
const { resolve, isThereHaveBrowserslistConfig } = require('./utils/projectHelper');
module.exports = function (modules) {
const plugins = [
@ -39,7 +39,9 @@ module.exports = function (modules) {
resolve('@babel/preset-env'),
{
modules,
targets: {
targets: isThereHaveBrowserslistConfig()
? undefined
: {
browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 11'],
},
},

View File

@ -1,4 +1,5 @@
import type { App, PropType, Plugin, Ref, VNode } from 'vue';
// @ts-ignore
import type { App, PropType, Plugin, Ref, VNode, SlotsType } from 'vue';
// https://stackoverflow.com/questions/46176165/ways-to-get-string-literal-type-of-array-values-without-enum-overhead
export const tuple = <T extends string[]>(...args: T) => args;
@ -87,3 +88,5 @@ export function stringType<T extends string = string>(defaultVal?: T) {
export function someType<T>(types?: any[], defaultVal?: T) {
return types ? { type: types as PropType<T>, default: defaultVal as T } : anyType<T>(defaultVal);
}
export type CustomSlotsType<T> = SlotsType<T>;

View File

@ -4,7 +4,7 @@ import { initDefaultProps } from '../_util/props-util';
import classNames from '../_util/classNames';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import { useInjectAnchor } from './context';
import type { Key, VueNode } from '../_util/type';
import type { Key, VueNode, CustomSlotsType } from '../_util/type';
import { objectType, anyType } from '../_util/type';
import type { CSSProperties } from '../_util/cssinjs/hooks/useStyleRegister';
@ -33,7 +33,11 @@ export default defineComponent({
name: 'AAnchorLink',
inheritAttrs: false,
props: initDefaultProps(anchorLinkProps(), { href: '#' }),
slots: ['title', 'customTitle'],
slots: Object as CustomSlotsType<{
title: any;
default: any;
customTitle: any;
}>,
setup(props, { slots, attrs }) {
let mergedTitle = null;
const {

View File

@ -6,9 +6,12 @@ import warning from '../_util/warning';
import Option from './Option';
import OptGroup from './OptGroup';
import omit from '../_util/omit';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import type { InputStatus } from '../_util/statusUtils';
import type { CustomSlotsType } from '../_util/type';
function isSelectOptionOrSelectOptGroup(child: any): boolean {
return child?.type?.isSelectOption || child?.type?.isSelectOptGroup;
}
@ -46,7 +49,12 @@ const AutoComplete = defineComponent({
inheritAttrs: false,
props: autoCompleteProps(),
// emits: ['change', 'select', 'focus', 'blur'],
slots: ['option'],
slots: Object as CustomSlotsType<{
options: any;
default: any;
notFoundContent: any;
dataSource: any;
}>,
setup(props, { slots, attrs, expose }) {
warning(
!('dataSource' in slots),

View File

@ -1,4 +1,4 @@
import type { VueNode } from '../_util/type';
import type { CustomSlotsType, VueNode } from '../_util/type';
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
import { computed, defineComponent, nextTick, onMounted, shallowRef, watch } from 'vue';
@ -42,7 +42,10 @@ const Avatar = defineComponent({
name: 'AAvatar',
inheritAttrs: false,
props: avatarProps(),
slots: ['icon'],
slots: Object as CustomSlotsType<{
icon: any;
default: any;
}>,
setup(props, { slots, attrs }) {
const isImgExist = shallowRef(true);
const isMounted = shallowRef(false);

View File

@ -11,7 +11,7 @@ import useConfigInject from '../config-provider/hooks/useConfigInject';
import isNumeric from '../_util/isNumeric';
import useStyle from './style';
import type { PresetColorKey } from '../theme/interface';
import type { LiteralUnion } from '../_util/type';
import type { LiteralUnion, CustomSlotsType } from '../_util/type';
import type { PresetStatusColorType } from '../_util/colors';
import { isPresetColor } from '../_util/colors';
@ -42,7 +42,11 @@ export default defineComponent({
Ribbon,
inheritAttrs: false,
props: badgeProps(),
slots: ['text', 'count'],
slots: Object as CustomSlotsType<{
text: any;
count: any;
default: any;
}>,
setup(props, { slots, attrs }) {
const { prefixCls, direction } = useConfigInject('badge', props);
const [wrapSSR, hashId] = useStyle(prefixCls);

View File

@ -1,4 +1,4 @@
import type { LiteralUnion } from '../_util/type';
import type { CustomSlotsType, LiteralUnion } from '../_util/type';
import type { PresetColorType } from '../_util/colors';
import useStyle from './style';
import { isPresetColor } from '../_util/colors';
@ -21,7 +21,10 @@ export default defineComponent({
name: 'ABadgeRibbon',
inheritAttrs: false,
props: ribbonProps(),
slots: ['text'],
slots: Object as CustomSlotsType<{
text: any;
default: any;
}>,
setup(props, { attrs, slots }) {
const { prefixCls, direction } = useConfigInject('ribbon', props);
const [wrapSSR, hashId] = useStyle(prefixCls);

View File

@ -6,9 +6,10 @@ import warning from '../_util/warning';
import type { BreadcrumbItemProps } from './BreadcrumbItem';
import BreadcrumbItem from './BreadcrumbItem';
import Menu from '../menu';
import type { VueNode } from '../_util/type';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import useStyle from './style';
import type { CustomSlotsType, VueNode } from '../_util/type';
export interface Route {
path: string;
breadcrumbName: string;
@ -57,7 +58,11 @@ export default defineComponent({
name: 'ABreadcrumb',
inheritAttrs: false,
props: breadcrumbProps(),
slots: ['separator', 'itemRender'],
slots: Object as CustomSlotsType<{
separator: any;
itemRender: { route: Route; params: any; routes: Route[]; paths: string[] };
default: any;
}>,
setup(props, { slots, attrs }) {
const { prefixCls, direction } = useConfigInject('breadcrumb', props);
const [wrapSSR, hashId] = useStyle(prefixCls);

View File

@ -8,6 +8,7 @@ import DownOutlined from '@ant-design/icons-vue/DownOutlined';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import type { MouseEventHandler } from '../_util/EventInterface';
import { eventType, objectType } from '../_util/type';
import type { CustomSlotsType } from '../_util/type';
export const breadcrumbItemProps = () => ({
prefixCls: String,
@ -26,7 +27,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, emit }) {
const { prefixCls } = useConfigInject('breadcrumb', props);
/**

View File

@ -20,6 +20,7 @@ import type { ButtonType } from './buttonTypes';
import type { VNode } from 'vue';
import { GroupSizeContext } from './button-group';
import { useCompactItemContext } from '../space/Compact';
import type { CustomSlotsType } from '../_util/type';
type Loading = boolean | number;
@ -36,7 +37,10 @@ export default defineComponent({
inheritAttrs: false,
__ANT_BUTTON: true,
props: initDefaultProps(buttonProps(), { type: 'default' }),
slots: ['icon'],
slots: Object as CustomSlotsType<{
icon: any;
default: any;
}>,
// emits: ['click', 'mousedown'],
setup(props, { slots, attrs, emit, expose }) {
const { prefixCls, autoInsertSpaceInButton, direction, size } = useConfigInject('btn', props);

View File

@ -37,7 +37,7 @@ Customize Calendar header content.
:value="String(current.year())"
@change="
newYear => {
onChange(current.year(newYear));
onChange(current.year(+newYear));
}
"
>

View File

@ -10,8 +10,8 @@ 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 { App } from 'vue';
import type { CustomSlotsType, VueNode } from '../_util/type';
import type { App, PropType } from 'vue';
import { computed, defineComponent, toRef } from 'vue';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import classNames from '../_util/classNames';
@ -88,36 +88,56 @@ function generateCalendar<
);
}
const Calendar = defineComponent<Props>({
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,
slots: [
'dateFullCellRender',
'dateCellRender',
'monthFullCellRender',
'monthCellRender',
'headerRender',
],
setup(props, { emit, slots, attrs }) {
props: {
prefixCls: String,
locale: { type: Object as PropType<Props['locale']>, default: undefined as Props['locale'] },
validRange: { type: Array as PropType<DateType[]>, default: undefined },
disabledDate: { type: Function as PropType<Props['disabledDate']>, default: undefined },
dateFullCellRender: {
type: Function as PropType<Props['dateFullCellRender']>,
default: undefined,
},
dateCellRender: { type: Function as PropType<Props['dateCellRender']>, default: undefined },
monthFullCellRender: {
type: Function as PropType<Props['monthFullCellRender']>,
default: undefined,
},
monthCellRender: { type: Function as PropType<Props['monthCellRender']>, default: undefined },
headerRender: { type: Function as PropType<Props['headerRender']>, default: undefined },
value: {
type: [Object, String] as PropType<Props['value']>,
default: undefined as Props['value'],
},
defaultValue: {
type: [Object, String] as PropType<Props['defaultValue']>,
default: undefined as Props['defaultValue'],
},
mode: { type: String as PropType<Props['mode']>, default: undefined },
fullscreen: { type: Boolean as PropType<Props['fullscreen']>, default: undefined },
onChange: { type: Function as PropType<Props['onChange']>, default: undefined },
'onUpdate:value': { type: Function as PropType<Props['onUpdate:value']>, default: undefined },
onPanelChange: { type: Function as PropType<Props['onPanelChange']>, default: undefined },
onSelect: { type: Function as PropType<Props['onSelect']>, default: undefined },
valueFormat: { type: String, default: undefined },
},
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(p, { emit, slots, attrs }) {
const props = p as unknown as Props;
const { prefixCls, direction } = useConfigInject('picker', props);
// style

View File

@ -9,6 +9,7 @@ import useConfigInject from '../config-provider/hooks/useConfigInject';
import devWarning from '../vc-util/devWarning';
import useStyle from './style';
import Skeleton from '../skeleton';
import type { CustomSlotsType } from '../_util/type';
export interface CardTabListType {
key: string;
tab: any;
@ -53,7 +54,15 @@ const Card = defineComponent({
name: 'ACard',
inheritAttrs: false,
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, attrs }) {
const { prefixCls, direction, size } = useConfigInject('card', props);
const [wrapSSR, hashId] = useStyle(prefixCls);

View File

@ -3,6 +3,7 @@ import { defineComponent } from 'vue';
import { getPropsSlot } from '../_util/props-util';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import { vNodeType } from '../_util/type';
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 '../config-provider/hooks/useConfigInject';
import type { CollapsePanelProps } from './CollapsePanel';
import collapseMotion from '../_util/collapseMotion';
import type { CustomSlotsType } from '../_util/type';
// CSSINJS
import useStyle from './style';
@ -44,8 +45,10 @@ export default defineComponent({
openAnimation: collapseMotion('ant-motion-collapse', false),
expandIconPosition: 'start',
}),
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,7 +7,7 @@ import Transition from '../_util/transition';
import classNames from '../_util/classNames';
import devWarning from '../vc-util/devWarning';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import type { CustomSlotsType } from '../_util/type';
export { collapsePanelProps };
export type CollapsePanelProps = Partial<ExtractPropTypes<ReturnType<typeof collapsePanelProps>>>;
export default defineComponent({
@ -21,7 +21,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 '../config-provider/hooks/useConfigInject';
@ -30,7 +30,14 @@ const Comment = defineComponent({
name: 'AComment',
inheritAttrs: false,
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, attrs }) {
const { prefixCls, direction } = useConfigInject('comment', props);
@ -50,7 +57,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

@ -23,6 +23,7 @@ import { getMergedStatus, getStatusClassNames } from '../../_util/statusUtils';
import useStyle from '../style';
import { useCompactItemContext } from '../../space/Compact';
import devWarning from '../../vc-util/devWarning';
import type { CustomSlotsType } from '../../_util/type';
export default function generateRangePicker<DateType, ExtraProps = {}>(
generateConfig: GenerateConfig<DateType>,
@ -37,18 +38,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

@ -18,7 +18,7 @@ import devWarning from '../../vc-util/devWarning';
import { FormItemInputContext, useInjectFormItemContext } from '../../form/FormItemContext';
import { getMergedStatus, getStatusClassNames } from '../../_util/statusUtils';
import { useCompactItemContext } from '../../space/Compact';
import type { CustomSlotsType } from '../../_util/type';
//CSSINJS
import useStyle from '../style';
@ -37,18 +37,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> &
@ -178,7 +179,7 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
id = formItemContext.id.value,
...restProps
} = p;
const showTime = (p as any).showTime === '' ? true : p.showTime;
const showTime = (p.showTime as string) === '' ? true : p.showTime;
const { format } = p as any;
let additionalOverrideProps: any = {};

View File

@ -26,7 +26,7 @@ import PropTypes from '../_util/vue-types';
import { cloneElement } from '../_util/vnode';
import { flattenChildren } from '../_util/props-util';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import type { CustomSlotsType } from '../_util/type';
import useStyle from './style';
export const DescriptionsItemProps = {
@ -51,7 +51,6 @@ export const DescriptionsItem = defineComponent({
compatConfig: { MODE: 3 },
name: 'ADescriptionsItem',
props: descriptionsItemProp(),
slots: ['label'],
setup(_, { slots }) {
return () => slots.default?.();
},
@ -164,7 +163,11 @@ const Descriptions = defineComponent({
name: 'ADescriptions',
inheritAttrs: false,
props: descriptionsProps(),
slots: ['title', 'extra'],
slots: Object as CustomSlotsType<{
title?: any;
extra?: any;
default?: any;
}>,
Item: DescriptionsItem,
setup(props, { slots, attrs }) {
const { prefixCls, direction } = useConfigInject('descriptions', props);

View File

@ -17,6 +17,7 @@ import PropTypes from '../_util/vue-types';
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import { objectType, withInstall } from '../_util/type';
import type { CustomSlotsType } from '../_util/type';
import omit from '../_util/omit';
import devWarning from '../vc-util/devWarning';
import type { KeyboardEventHandler, MouseEventHandler } from '../_util/EventInterface';
@ -114,7 +115,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 = shallowRef(false);

View File

@ -6,8 +6,11 @@ import classNames from '../_util/classNames';
import { initDefaultProps } from '../_util/props-util';
import { dropdownButtonProps } from './props';
import EllipsisOutlined from '@ant-design/icons-vue/EllipsisOutlined';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import useStyle from './style';
import type { CustomSlotsType } from '../_util/type';
const ButtonGroup = Button.Group;
export type DropdownButtonProps = Partial<ExtractPropTypes<ReturnType<typeof dropdownButtonProps>>>;
@ -22,8 +25,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

@ -14,6 +14,7 @@ import getPlacements from '../_util/placements';
import warning from '../_util/warning';
import useStyle from './style';
import { useProvideOverride } from '../menu/src/OverrideContext';
import type { CustomSlotsType } from '../_util/type';
export type DropdownProps = Partial<ExtractPropTypes<ReturnType<typeof dropdownProps>>>;
@ -28,7 +29,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

@ -32,6 +32,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,
@ -149,7 +150,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

@ -4,7 +4,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';
import { filterEmpty } from '../_util/props-util';
@ -25,7 +25,12 @@ export interface FormItemInputProps {
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

@ -24,6 +24,7 @@ import useStyle from './style';
import { NoCompactStyle, useCompactItemContext } from '../space/Compact';
import { useInjectDisabled } from '../config-provider/DisabledContext';
import type { CustomSlotsType } from '../_util/type';
const baseProps = baseInputNumberProps();
export const inputNumberProps = () => ({
...baseProps,
@ -49,7 +50,15 @@ 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;
upIcon?: any;
downIcon?: any;
}>,
setup(props, { emit, expose, attrs, slots }) {
const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject();

View File

@ -11,6 +11,7 @@ import type { ChangeEvent, KeyboardEventHandler } from '../../_util/EventInterfa
import KeyCode from '../../_util/KeyCode';
import classNames from '../../_util/classNames';
import { booleanType, stringType, someType, functionType } from '../../_util/type';
import type { CustomSlotsType } from '../../_util/type';
/**
* We support `stringMode` which need handle correct type when user call in onChange
@ -83,7 +84,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 = shallowRef<HTMLInputElement>();
const focus = shallowRef(false);

View File

@ -2,6 +2,7 @@ import isMobile from '../../vc-util/isMobile';
import { onBeforeUnmount, ref, defineComponent } from 'vue';
import classNames from '../../_util/classNames';
import { functionType } from '../../_util/type';
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: functionType<(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 '../config-provider/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 '../config-provider/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,6 @@ 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 {
arrayType,
someType,
@ -20,6 +19,7 @@ import {
vNodeType,
functionType,
} from '../_util/type';
import type { CustomSlotsType, Key } from '../_util/type';
import ItemMeta from './ItemMeta';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import useBreakpoint from '../_util/hooks/useBreakpoint';
@ -90,7 +90,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, attrs }) {
provide(ListContextKey, {
grid: toRef(props, 'grid'),

View File

@ -17,6 +17,7 @@ import { useProvideOverride } from '../menu/src/OverrideContext';
import warning from '../_util/warning';
import Spin from '../spin';
import devWarning from '../vc-util/devWarning';
import type { CustomSlotsType } from '../_util/type';
interface MentionsConfig {
prefix?: string | string[];
@ -103,7 +104,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 }) {
// =================== Warning =====================
if (process.env.NODE_ENV !== 'production') {

View File

@ -6,6 +6,7 @@ import { useInjectMenu } from './hooks/useMenuContext';
import { useMeasure } from './hooks/useKeyPath';
import type { ItemType } from './interface';
import { objectType } from '../../_util/type';
import type { CustomSlotsType } from '../../_util/type';
export const menuItemGroupProps = () => ({
title: PropTypes.any,
@ -20,7 +21,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 {
shallowRef,
@ -58,9 +58,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' },
@ -95,7 +95,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 { direction, getPrefixCls } = useConfigInject('menu', props);
const override = useInjectOverride();

View File

@ -20,6 +20,7 @@ import Overflow from '../../vc-overflow';
import devWarning from '../../vc-util/devWarning';
import type { MouseEventHandler } from '../../_util/EventInterface';
import { objectType } from '../../_util/type';
import type { CustomSlotsType } from '../../_util/type';
let indexGuid = 0;
export const menuItemProps = () => ({
@ -45,8 +46,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 = shallowRef(false);

View File

@ -27,7 +27,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 '../../_util/type';
import type { Key, CustomSlotsType } from '../../_util/type';
import { objectType } from '../../_util/type';
import type { ItemType, MenuTheme } from './interface';
@ -59,8 +59,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

@ -9,8 +9,11 @@ import type { AvatarProps } from '../avatar';
import Avatar from '../avatar';
import TransButton from '../_util/transButton';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import { objectType, vNodeType, withInstall } from '../_util/type';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import type { CustomSlotsType } from '../_util/type';
import classNames from '../_util/classNames';
import ResizeObserver from '../vc-resize-observer';
import useDestroyed from '../_util/hooks/useDestroyed';
@ -42,7 +45,17 @@ const PageHeader = defineComponent({
inheritAttrs: false,
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, attrs }) {
const { prefixCls, direction, pageHeader } = useConfigInject('page-header', props);

View File

@ -8,8 +8,11 @@ import { convertLegacyProps } from '../button/buttonTypes';
import ExclamationCircleFilled from '@ant-design/icons-vue/ExclamationCircleFilled';
import Button from '../button';
import { useLocaleReceiver } from '../locale-provider/LocaleReceiver';
import defaultLocale from '../locale/en_US';
import { anyType, objectType, stringType, withInstall } from '../_util/type';
import type { CustomSlotsType } from '../_util/type';
import useMergedState from '../_util/hooks/useMergedState';
import KeyCode from '../_util/KeyCode';
@ -63,7 +66,18 @@ const Popconfirm = defineComponent({
okType: 'primary',
disabled: false,
}),
slots: ['title', 'content', 'okText', 'icon', 'cancelText', 'cancelButton', 'okButton'],
slots: Object as CustomSlotsType<{
title?: any;
content?: any;
description?: any;
okText?: any;
icon?: any;
cancel?: any;
cancelText?: any;
cancelButton?: any;
okButton?: any;
default?: any;
}>,
// emits: ['update:open', 'visibleChange'],
setup(props: PopconfirmProps, { slots, emit, expose, attrs }) {
const rootRef = ref();

View File

@ -11,7 +11,7 @@ import { getSize, getSuccessPercent, validProgress } from './utils';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import devWarning from '../vc-util/devWarning';
import { progressProps, progressStatuses } from './props';
import type { VueNode } from '../_util/type';
import type { VueNode, CustomSlotsType, VueNode } from '../_util/type';
import useStyle from './style';
export default defineComponent({
@ -27,7 +27,10 @@ export default defineComponent({
size: 'default',
strokeLinecap: 'round',
}),
slots: ['format'],
slots: Object as CustomSlotsType<{
default?: any;
format?: any;
}>,
setup(props, { slots, attrs }) {
const { prefixCls, direction } = useConfigInject('progress', props);
const [wrapSSR, hashId] = useStyle(prefixCls);

View File

@ -10,6 +10,7 @@ import serverError from './serverError';
import unauthorized from './unauthorized';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import classNames from '../_util/classNames';
import type { CustomSlotsType } from '../_util/type';
import useStyle from './style';
@ -65,7 +66,13 @@ const Result = defineComponent({
name: 'AResult',
inheritAttrs: false,
props: resultProps(),
slots: ['title', 'subTitle', 'icon', 'extra'],
slots: Object as CustomSlotsType<{
title?: any;
subTitle?: any;
icon?: any;
extra?: any;
default?: any;
}>,
setup(props, { slots, attrs }) {
const { prefixCls, direction } = useConfigInject('result', props);

View File

@ -15,6 +15,7 @@ import type { SelectCommonPlacement } from '../_util/transition';
import { getTransitionDirection, getTransitionName } from '../_util/transition';
import type { SizeType } from '../config-provider';
import { initDefaultProps } from '../_util/props-util';
import type { InputStatus } from '../_util/statusUtils';
import { getStatusClassNames, getMergedStatus } from '../_util/statusUtils';
import { stringType, someType, functionType, booleanType } from '../_util/type';
@ -24,6 +25,8 @@ import useStyle from './style';
import { useInjectDisabled } from '../config-provider/DisabledContext';
import devWarning from '../vc-util/devWarning';
import type { CustomSlotsType } from '../_util/type';
type RawValue = string | number;
export type OptionType = typeof Option;
@ -76,20 +79,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,8 @@ 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 { VueNode, CustomSlotsType } from '../_util/type';
import {
stringType,
booleanType,
@ -94,7 +95,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 }) {
// Warning for deprecated usage
if (process.env.NODE_ENV !== 'production') {

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 { booleanType, tuple } from '../_util/type';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import useFlexGapSupport from '../_util/hooks/useFlexGapSupport';
@ -38,7 +39,10 @@ const Space = defineComponent({
name: 'ASpace',
inheritAttrs: false,
props: spaceProps(),
slots: ['split'],
slots: Object as CustomSlotsType<{
split?: any;
default?: any;
}>,
setup(props, { slots, attrs }) {
const { prefixCls, space, direction: directionConfig } = useConfigInject('space', props);
const [wrapSSR, hashId] = useStyle(prefixCls);

View File

@ -9,6 +9,7 @@ import useConfigInject from '../config-provider/hooks/useConfigInject';
// CSSINJS
import useStyle from './style';
import { anyType, booleanType, functionType, someType, vNodeType } from '../_util/type';
import type { CustomSlotsType } from '../_util/type';
export const statisticProps = () => ({
prefixCls: String,
@ -37,7 +38,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, attrs }) {
const { prefixCls, direction } = useConfigInject('statistic', props);

View File

@ -2,7 +2,7 @@ import type { App, ExtractPropTypes } from 'vue';
import { computed, defineComponent } from 'vue';
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
import CheckOutlined from '@ant-design/icons-vue/CheckOutlined';
import type { VueNode } from '../_util/type';
import type { VueNode, CustomSlotsType } from '../_util/type';
import { anyType, booleanType, stringType, functionType, someType, arrayType } from '../_util/type';
import initDefaultProps from '../_util/props-util/initDefaultProps';
import VcSteps, { Step as VcStep } from '../vc-steps';
@ -61,7 +61,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 '../config-provider/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 } 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 '../config-provider/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 {
stringType,
booleanType,
@ -58,6 +59,7 @@ import {
// CSSINJS
import useStyle from './style';
import type { CustomSlotsType } from '../_util/type';
export type { ColumnsType, TablePaginationConfig };
@ -179,35 +181,22 @@ export const tableProps = () => {
>(),
sortDirections: arrayType<SortOrder[]>(),
showSorterTooltip: someType<boolean | TooltipProps>([Boolean, Object], true),
contextSlots: objectType<ContextSlots>(),
transformCellText: functionType<TableProps['transformCellText']>(),
};
};
const InteralTable = defineComponent<
TableProps & {
contextSlots: ContextSlots;
}
>({
const InteralTable = defineComponent({
name: 'InteralTable',
inheritAttrs: false,
props: initDefaultProps(tableProps(), {
props: initDefaultProps(
{
...tableProps(),
contextSlots: objectType<ContextSlots>(),
},
{
rowKey: 'key',
}) as any,
// emits: ['expandedRowsChange', 'change', 'expand'],
slots: [
'emptyText',
'expandIcon',
'title',
'footer',
'summary',
'expandedRowRender',
'bodyCell',
'headerCell',
'customFilterIcon',
'customFilterDropdown',
'expandColumnTitle',
],
},
),
setup(props, { attrs, slots, expose, emit }) {
devWarning(
!(typeof props.rowKey === 'function' && props.rowKey.length > 1),
@ -651,9 +640,34 @@ const InteralTable = defineComponent<
},
});
const Table = defineComponent<TableProps>({
const Table = defineComponent({
name: 'ATable',
inheritAttrs: false,
props: initDefaultProps(tableProps(), {
rowKey: 'key',
}),
slots: Object as CustomSlotsType<{
emptyText?: any;
expandIcon?: RenderExpandIconProps<any>;
title?: any;
footer?: any;
summary?: any;
expandedRowRender?: any;
bodyCell?: {
text: any;
value: any;
record: Record<string, any>;
index: number;
column: ColumnType;
};
headerCell?: {
title: any;
column: ColumnType;
};
customFilterIcon?: any;
customFilterDropdown?: any;
default: any;
}>,
setup(_props, { attrs, slots, expose }) {
const table = ref();
expose({

View File

@ -67,7 +67,10 @@ const data = [
</script>
<style scoped>
.ant-table-striped :deep(.table-striped) td {
[data-doc-theme='light'] .ant-table-striped :deep(.table-striped) td {
background-color: #fafafa;
}
[data-doc-theme='dark'] .ant-table-striped :deep(.table-striped) td {
background-color: rgb(29, 29, 29);
}
</style>

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 { functionType } from '../../../_util/type';
import KeyCode from '../../../_util/KeyCode';
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
@ -41,7 +41,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,8 +16,8 @@ import OperationNode from './OperationNode';
import { useInjectTabs } from '../TabContext';
import useTouchMove from '../hooks/useTouchMove';
import AddButton from './AddButton';
import type { Key } from '../../../_util/type';
import { objectType, functionType } from '../../../_util/type';
import type { CustomSlotsType, Key } from '../../../_util/type';
import type { ExtractPropTypes, PropType, CSSProperties } from 'vue';
import { shallowRef, onBeforeUnmount, defineComponent, watch, watchEffect, computed } from 'vue';
import PropTypes from '../../../_util/vue-types';
@ -69,7 +69,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,6 @@ 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 {
arrayType,
stringType,
@ -32,6 +31,7 @@ import {
objectType,
booleanType,
} 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';
@ -133,15 +133,16 @@ const InternalTabs = defineComponent({
}),
tabs: arrayType<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(
@ -351,15 +352,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,8 +6,9 @@ import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
import Wave from '../_util/wave';
import type { PresetColorType, PresetStatusColorType } from '../_util/colors';
import { isPresetColor, isPresetStatusColor } from '../_util/colors';
import type { LiteralUnion } from '../_util/type';
import { eventType } from '../_util/type';
import type { CustomSlotsType, LiteralUnion } from '../_util/type';
import CheckableTag from './CheckableTag';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import warning from '../_util/warning';
@ -39,7 +40,11 @@ const Tag = defineComponent({
inheritAttrs: false,
props: tagProps(),
// emits: ['update:visible', 'close'],
slots: ['closeIcon', 'icon'],
slots: Object as CustomSlotsType<{
closeIcon: any;
icon: any;
default: any;
}>,
setup(props, { slots, emit, attrs }) {
const { prefixCls, direction } = useConfigInject('tag', props);

View File

@ -14,8 +14,10 @@ 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 { InputStatus } from '../_util/statusUtils';
import { booleanType, stringType } from '../_util/type';
import type { CustomSlotsType } from '../_util/type';
export interface TimePickerLocale {
placeholder?: string;
@ -75,7 +77,7 @@ function createTimePicker<
});
const { TimePicker: InternalTimePicker, RangePicker: InternalRangePicker } = DatePicker as any;
const TimePicker = defineComponent<DTimePickerProps>({
const TimePicker = defineComponent({
name: 'ATimePicker',
inheritAttrs: false,
props: {
@ -83,9 +85,16 @@ function createTimePicker<
...datePickerProps<DateType>(),
...timePickerProps(),
addon: { type: Function },
} as any,
slot: ['addon', 'renderExtraFooter', 'suffixIcon', 'clearIcon'],
setup(props, { slots, expose, emit, attrs }) {
},
slots: Object as CustomSlotsType<{
addon?: any;
renderExtraFooter?: any;
suffixIcon?: any;
clearIcon?: any;
default: any;
}>,
setup(p, { slots, expose, emit, attrs }) {
const props = p as unknown as DTimePickerProps;
const formItemContext = useInjectFormItemContext();
devWarning(
!(slots.addon || props.addon),
@ -146,7 +155,7 @@ function createTimePicker<
},
});
const TimeRangePicker = defineComponent<DTimeRangePickerProps>({
const TimeRangePicker = defineComponent({
name: 'ATimeRangePicker',
inheritAttrs: false,
props: {
@ -154,9 +163,15 @@ function createTimePicker<
...rangePickerProps<DateType>(),
...timePickerProps(),
order: { type: Boolean, default: true },
} as any,
slot: ['renderExtraFooter', 'suffixIcon', 'clearIcon'],
setup(props, { slots, expose, emit, attrs }) {
},
slots: Object as CustomSlotsType<{
renderExtraFooter?: any;
suffixIcon?: any;
clearIcon?: any;
default: any;
}>,
setup(p, { slots, expose, emit, attrs }) {
const props = p as unknown as DTimeRangePickerProps;
const pickerRef = ref();
const formItemContext = useInjectFormItemContext();
expose({

View File

@ -6,11 +6,13 @@ 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 { tuple, booleanType } from '../_util/type';
import useConfigInject from '../config-provider/hooks/useConfigInject';
// CSSINJS
import useStyle from './style';
import type { CustomSlotsType } from '../_util/type';
export const timelineProps = () => ({
prefixCls: String,
@ -31,7 +33,11 @@ export default defineComponent({
reverse: false,
mode: '',
}),
slots: ['pending', 'pendingDot'],
slots: Object as CustomSlotsType<{
pending?: any;
pendingDot?: any;
default?: any;
}>,
setup(props, { slots, attrs }) {
const { prefixCls, direction } = useConfigInject('timeline', props);

View File

@ -2,8 +2,10 @@ import type { ExtractPropTypes } from 'vue';
import { computed, defineComponent } from 'vue';
import PropTypes from '../_util/vue-types';
import initDefaultProps from '../_util/props-util/initDefaultProps';
import { tuple, booleanType } from '../_util/type';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import type { CustomSlotsType } from '../_util/type';
export const timelineItemProps = () => ({
prefixCls: String,
@ -23,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);
const itemClassName = computed(() => ({

View File

@ -18,10 +18,12 @@ import useConfigInject from '../config-provider/hooks/useConfigInject';
import getPlacements from '../_util/placements';
import firstNotUndefined from '../_util/firstNotUndefined';
import raf from '../_util/raf';
import { parseColor } from './util';
export type { AdjustOverflow, PlacementsConfig } from '../_util/placements';
import useStyle from './style';
import { getTransitionName } from '../_util/transition';
import type { CustomSlotsType } from '../_util/type';
// https://github.com/react-component/tooltip
// https://github.com/yiminghe/dom-align
@ -79,7 +81,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 }) {
if (process.env.NODE_ENV !== 'production') {

View File

@ -6,8 +6,9 @@ import classNames from '../_util/classNames';
import List from './list';
import Operation from './operation';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import defaultLocale from '../locale/en_US';
import type { VueNode } from '../_util/type';
import type { VueNode, CustomSlotsType } from '../_util/type';
import {
withInstall,
stringType,
@ -18,6 +19,7 @@ import {
functionType,
} from '../_util/type';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import type { TransferListBodyProps } from './ListBody';
import type { PaginationType } from './interface';
import { FormItemInputContext, useInjectFormItemContext } from '../form/FormItemContext';
@ -123,16 +125,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

@ -13,6 +13,7 @@ import type { RadioChangeEvent } from '../radio/interface';
import type { TransferDirection, TransferItem } from './index';
import { stringType, arrayType, booleanType } from '../_util/type';
import { groupKeysMap } from '../_util/transKeys';
import type { CustomSlotsType } from '../_util/type';
const defaultRender = () => null;
@ -69,7 +70,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 { FormItemInputContext, useInjectFormItemContext } from '../form/FormItem
import type { BaseSelectRef } from '../vc-select';
import type { BaseOptionType, DefaultOptionType } from '../vc-tree-select/TreeSelect';
import type { TreeProps } from '../tree';
import type { SelectCommonPlacement } from '../_util/transition';
import { getTransitionDirection } from '../_util/transition';
import type { InputStatus } from '../_util/statusUtils';
@ -36,6 +37,8 @@ import useStyle from './style';
import { useCompactItemContext } from '../space/Compact';
import { useInjectDisabled } from '../config-provider/DisabledContext';
import type { CustomSlotsType } from '../_util/type';
const getTransitionName = (rootPrefixCls: string, motion: string, transitionName?: string) => {
if (transitionName !== undefined) {
return transitionName;
@ -96,15 +99,17 @@ 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;
leafIcon?: any;
}>,
setup(props, { attrs, slots, expose, emit }) {
warning(
!(props.treeData === undefined && slots.default),

View File

@ -19,6 +19,7 @@ import { calcRangeKeys, convertDirectoryKeysToNodes } from './utils/dictUtil';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import { filterEmpty } from '../_util/props-util';
import { someType } from '../_util/type';
import type { CustomSlotsType } from '../_util/type';
export type ExpandAction = false | 'click' | 'doubleclick' | 'dblclick';
@ -45,7 +46,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

@ -19,6 +19,7 @@ import { booleanType, someType, arrayType, functionType, objectType } from '../_
// CSSINJS
import useStyle from './style';
import type { CustomSlotsType } from '../_util/type';
export interface AntdTreeNodeAttribute {
eventKey: string;
@ -150,17 +151,15 @@ 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;
leafIcon?: any;
}>,
setup(props, { attrs, expose, emit, slots }) {
warning(
!(props.treeData === undefined && slots.default),

View File

@ -21,10 +21,10 @@ export const typographyProps = () => ({
// Form Internal use
component: String,
});
const Typography = defineComponent<InternalTypographyProps>({
const Typography = defineComponent({
name: 'ATypography',
inheritAttrs: false,
props: typographyProps() as any,
props: typographyProps(),
setup(props, { slots, attrs }) {
const { prefixCls, direction } = useConfigInject('typography', props);
@ -34,20 +34,19 @@ const Typography = defineComponent<InternalTypographyProps>({
return () => {
const {
prefixCls: _prefixCls,
class: _className,
direction: _direction,
component: Component = 'article' as any,
...restProps
} = { ...props, ...attrs };
return wrapSSR(
<Component
{...restProps}
class={classNames(
prefixCls.value,
{ [`${prefixCls.value}-rtl`]: direction.value === 'rtl' },
attrs.class,
hashId.value,
)}
{...restProps}
>
{slots.default?.()}
</Component>,

View File

@ -112,7 +112,7 @@ When uploading state change, it returns:
### How to select albums or folders on mobile devices?
You can set `:accept="null"`
You can set `:capture="null"`
### I want to display download links.

View File

@ -113,7 +113,7 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*l1nlSryXib8AAA
### 手机设备如何选择相册或文件夹?
你可以设置 `:accept="null"`
你可以设置 `:capture="null"`
### 如何显示下载链接?

View File

@ -24,7 +24,6 @@ const DrawerWrapper = defineComponent({
autofocus: true,
}),
emits: ['handleClick', 'close'],
slots: ['handler'],
setup(props, { emit, slots }) {
const dom = ref<HTMLElement>(null);

View File

@ -34,7 +34,6 @@ export default defineComponent({
mouseLeaveDelay: PropTypes.number.def(0.1),
},
emits: ['visibleChange', 'overlayClick'],
slots: ['overlay'],
setup(props, { slots, emit, expose }) {
const triggerVisible = ref(!!props.visible);
watch(

View File

@ -16,7 +16,6 @@ export default defineComponent({
default: () => [],
},
},
slots: ['notFoundContent', 'option'],
setup(props, { slots }) {
const {
activeIndex,

View File

@ -56,7 +56,6 @@ export default defineComponent({
direction: String,
dropdownClassName: String,
},
slots: ['notFoundContent', 'option'],
setup(props, { slots }) {
const getDropdownPrefix = () => {
return `${props.prefixCls}-dropdown`;

View File

@ -37,7 +37,6 @@ export default defineComponent({
name: 'Mentions',
inheritAttrs: false,
props: initDefaultProps(vcMentionsProps, defaultProps),
slots: ['notFoundContent', 'option'],
emits: ['change', 'select', 'search', 'focus', 'blur', 'pressenter'],
setup(props, { emit, attrs, expose, slots }) {
const measure = ref(null);

View File

@ -196,15 +196,6 @@ function Picker<DateType>() {
'secondStep',
'hideDisabledOptions',
] as any,
// slots: [
// 'suffixIcon',
// 'clearIcon',
// 'prevIcon',
// 'nextIcon',
// 'superPrevIcon',
// 'superNextIcon',
// 'panelRender',
// ],
setup(props, { attrs, expose }) {
const inputRef = ref(null);
const presets = computed(() => props.presets);

View File

@ -37,7 +37,6 @@ const OptionList = defineComponent({
compatConfig: { MODE: 3 },
name: 'OptionList',
inheritAttrs: false,
slots: ['option'],
setup(_, { expose, slots }) {
const baseProps = useBaseProps();
const props = useSelectProps();

View File

@ -43,7 +43,6 @@ export default function createSlider(Component) {
name: 'CreateSlider',
mixins: [BaseMixin, Component],
inheritAttrs: false,
slots: ['mark'],
props: initDefaultProps(propTypes, {
prefixCls: 'rc-slider',
min: 0,

View File

@ -45,7 +45,6 @@ export default defineComponent({
name: 'Step',
inheritAttrs: false,
props: VcStepProps(),
slots: ['title', 'subTitle', 'description', 'tailContent', 'stepIcon', 'progressDot'],
setup(props, { slots, emit, attrs }) {
const onItemClick: EventHandler = e => {
emit('click', e);

View File

@ -32,7 +32,6 @@ export default defineComponent({
isInline: PropTypes.looseBool,
itemRender: functionType<(item: Record<string, any>, stepItem: VueNode) => VueNode>(),
},
slots: ['stepIcon', 'progressDot'],
emits: ['change'],
setup(props, { slots, emit }) {
const onStepClick = (next: number) => {

View File

@ -32,7 +32,6 @@ export default defineComponent<BodyProps<any>>({
'rowExpandable',
'childrenColumnName',
] as any,
slots: ['emptyNode'],
setup(props, { slots }) {
const resizeContext = useInjectResize();
const tableContext = useInjectTable();

View File

@ -103,7 +103,6 @@ export default defineComponent<CellProps>({
'cellType',
'transformCellText',
] as any,
slots: ['appendNode'],
setup(props, { slots }) {
const contextSlots = useInjectSlots();
const { onHover, startRow, endRow } = useInjectHover();

View File

@ -192,7 +192,6 @@ export default defineComponent<TableProps<DefaultRecordType>>({
'onUpdateInternalRefs',
'transformCellText',
] as any,
slots: ['title', 'footer', 'summary', 'emptyText'],
emits: ['expand', 'expandedRowsChange', 'updateInternalRefs', 'update:expandedRowKeys'],
setup(props, { attrs, slots, emit }) {
const mergedData = computed(() => props.data || EMPTY_DATA);

View File

@ -14,7 +14,6 @@ export default defineComponent({
compatConfig: { MODE: 3 },
name: 'Content',
props: tooltipContentProps,
slots: ['overlay'],
setup(props: TooltipContentProps, { slots }) {
return () => (
<div

View File

@ -37,7 +37,6 @@ export default defineComponent({
onVisibleChange: Function,
onPopupAlign: Function,
},
slots: ['arrowContent', 'overlay'],
setup(props, { slots, attrs, expose }) {
const triggerDOM = shallowRef();

View File

@ -35,7 +35,6 @@ export default defineComponent({
compatConfig: { MODE: 3 },
name: 'OptionList',
inheritAttrs: false,
slots: ['notFoundContent', 'menuItemSelectedIcon'],
setup(_, { slots, expose }) {
const baseProps = useBaseProps();
const legacyContext = useInjectLegacySelectContext();

View File

@ -29,7 +29,6 @@ export default defineComponent({
motionType: String,
// treeNodeRequiredProps: { type: Object as PropType<TreeNodeRequiredProps> },
},
slots: ['title', 'icon', 'switcherIcon', 'checkable'],
setup(props, { attrs, slots }) {
const visible = shallowRef(true);
const context = useInjectTreeContext();

View File

@ -54,7 +54,6 @@ export default defineComponent({
compatConfig: { MODE: 3 },
name: 'Tree',
inheritAttrs: false,
slots: ['checkable', 'title', 'icon', 'titleRender'],
props: initDefaultProps(treeProps(), {
prefixCls: 'vc-tree',
showLine: false,

View File

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

View File

@ -259,7 +259,6 @@
"vanilla-jsoneditor": "^0.15.1",
"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",
@ -268,7 +267,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",