perf: ts type, close #5044
parent
18cc95fa30
commit
2c2c070663
|
@ -1,8 +1,9 @@
|
||||||
import type { RequiredMark } from '../../form/Form';
|
import type { RequiredMark } from '../../form/Form';
|
||||||
import type { ComputedRef, UnwrapRef, VNodeChild } from 'vue';
|
import type { ComputedRef, UnwrapRef } from 'vue';
|
||||||
import { computed, inject } from 'vue';
|
import { computed, inject } from 'vue';
|
||||||
import type { ConfigProviderProps, Direction, SizeType } from '../../config-provider';
|
import type { ConfigProviderProps, Direction, SizeType } from '../../config-provider';
|
||||||
import { defaultConfigProvider } from '../../config-provider';
|
import { defaultConfigProvider } from '../../config-provider';
|
||||||
|
import type { VueNode } from '../type';
|
||||||
|
|
||||||
export default (
|
export default (
|
||||||
name: string,
|
name: string,
|
||||||
|
@ -20,7 +21,7 @@ export default (
|
||||||
requiredMark?: RequiredMark;
|
requiredMark?: RequiredMark;
|
||||||
}>;
|
}>;
|
||||||
autoInsertSpaceInButton: ComputedRef<boolean>;
|
autoInsertSpaceInButton: ComputedRef<boolean>;
|
||||||
renderEmpty?: ComputedRef<(componentName?: string) => VNodeChild | JSX.Element>;
|
renderEmpty?: ComputedRef<(componentName?: string) => VueNode>;
|
||||||
virtual: ComputedRef<boolean>;
|
virtual: ComputedRef<boolean>;
|
||||||
dropdownMatchSelectWidth: ComputedRef<boolean | number>;
|
dropdownMatchSelectWidth: ComputedRef<boolean | number>;
|
||||||
getPopupContainer: ComputedRef<ConfigProviderProps['getPopupContainer']>;
|
getPopupContainer: ComputedRef<ConfigProviderProps['getPopupContainer']>;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { App, PropType, VNodeChild, Plugin, Ref } from 'vue';
|
import type { App, PropType, Plugin, Ref, VNode } from 'vue';
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/46176165/ways-to-get-string-literal-type-of-array-values-without-enum-overhead
|
// 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;
|
export const tuple = <T extends string[]>(...args: T) => args;
|
||||||
|
@ -29,7 +29,8 @@ export interface PropOptions<T = any, D = T> {
|
||||||
validator?(value: unknown): boolean;
|
validator?(value: unknown): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type VueNode = VNodeChild | JSX.Element;
|
declare type VNodeChildAtom = VNode | string | number | boolean | null | undefined | void;
|
||||||
|
export type VueNode = VNodeChildAtom | VNodeChildAtom[] | JSX.Element;
|
||||||
|
|
||||||
export const withInstall = <T>(comp: T) => {
|
export const withInstall = <T>(comp: T) => {
|
||||||
const c = comp as any;
|
const c = comp as any;
|
||||||
|
|
|
@ -26,7 +26,7 @@ PropTypes.extend([
|
||||||
default: undefined,
|
default: undefined,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'VNodeChild',
|
name: 'VueNode',
|
||||||
getter: true,
|
getter: true,
|
||||||
type: null,
|
type: null,
|
||||||
},
|
},
|
||||||
|
@ -39,5 +39,5 @@ export function withUndefined<T extends { default?: any }>(type: T): T {
|
||||||
export default PropTypes as VueTypesInterface & {
|
export default PropTypes as VueTypesInterface & {
|
||||||
readonly looseBool: VueTypeValidableDef<boolean>;
|
readonly looseBool: VueTypeValidableDef<boolean>;
|
||||||
readonly style: VueTypeValidableDef<CSSProperties>;
|
readonly style: VueTypeValidableDef<CSSProperties>;
|
||||||
readonly VNodeChild: VueTypeValidableDef<VueNode>;
|
readonly VueNode: VueTypeValidableDef<VueNode>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,19 +45,19 @@ const alertProps = {
|
||||||
/** Whether Alert can be closed */
|
/** Whether Alert can be closed */
|
||||||
closable: PropTypes.looseBool,
|
closable: PropTypes.looseBool,
|
||||||
/** Close text to show */
|
/** Close text to show */
|
||||||
closeText: PropTypes.VNodeChild,
|
closeText: PropTypes.any,
|
||||||
/** Content of Alert */
|
/** Content of Alert */
|
||||||
message: PropTypes.VNodeChild,
|
message: PropTypes.any,
|
||||||
/** Additional content of Alert */
|
/** Additional content of Alert */
|
||||||
description: PropTypes.VNodeChild,
|
description: PropTypes.any,
|
||||||
/** Trigger when animation ending of Alert */
|
/** Trigger when animation ending of Alert */
|
||||||
afterClose: PropTypes.func.def(noop),
|
afterClose: PropTypes.func.def(noop),
|
||||||
/** Whether to show icon */
|
/** Whether to show icon */
|
||||||
showIcon: PropTypes.looseBool,
|
showIcon: PropTypes.looseBool,
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
banner: PropTypes.looseBool,
|
banner: PropTypes.looseBool,
|
||||||
icon: PropTypes.VNodeChild,
|
icon: PropTypes.any,
|
||||||
onClose: PropTypes.VNodeChild,
|
onClose: PropTypes.any,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type AlertProps = Partial<ExtractPropTypes<typeof alertProps>>;
|
export type AlertProps = Partial<ExtractPropTypes<typeof alertProps>>;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { useInjectAnchor } from './context';
|
||||||
const anchorLinkProps = {
|
const anchorLinkProps = {
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
href: PropTypes.string.def('#'),
|
href: PropTypes.string.def('#'),
|
||||||
title: PropTypes.VNodeChild,
|
title: PropTypes.any,
|
||||||
target: PropTypes.string,
|
target: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ export const avatarProps = {
|
||||||
src: PropTypes.string,
|
src: PropTypes.string,
|
||||||
/** Srcset of image avatar */
|
/** Srcset of image avatar */
|
||||||
srcset: PropTypes.string,
|
srcset: PropTypes.string,
|
||||||
icon: PropTypes.VNodeChild,
|
icon: PropTypes.any,
|
||||||
alt: PropTypes.string,
|
alt: PropTypes.string,
|
||||||
gap: PropTypes.number,
|
gap: PropTypes.number,
|
||||||
draggable: PropTypes.bool,
|
draggable: PropTypes.bool,
|
||||||
|
|
|
@ -26,7 +26,7 @@ export const badgeProps = {
|
||||||
// sync antd@4.6.0
|
// sync antd@4.6.0
|
||||||
size: PropTypes.oneOf(tuple('default', 'small')).def('default'),
|
size: PropTypes.oneOf(tuple('default', 'small')).def('default'),
|
||||||
color: PropTypes.string,
|
color: PropTypes.string,
|
||||||
text: PropTypes.VNodeChild,
|
text: PropTypes.any,
|
||||||
offset: PropTypes.arrayOf(PropTypes.oneOfType([String, Number])),
|
offset: PropTypes.arrayOf(PropTypes.oneOfType([String, Number])),
|
||||||
numberStyle: PropTypes.style,
|
numberStyle: PropTypes.style,
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
|
|
|
@ -36,7 +36,7 @@ const buttonProps = () => ({
|
||||||
ghost: PropTypes.looseBool,
|
ghost: PropTypes.looseBool,
|
||||||
block: PropTypes.looseBool,
|
block: PropTypes.looseBool,
|
||||||
danger: PropTypes.looseBool,
|
danger: PropTypes.looseBool,
|
||||||
icon: PropTypes.VNodeChild,
|
icon: PropTypes.any,
|
||||||
href: PropTypes.string,
|
href: PropTypes.string,
|
||||||
target: PropTypes.string,
|
target: PropTypes.string,
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
|
|
|
@ -20,8 +20,8 @@ export const CarouselProps = {
|
||||||
// style: PropTypes.React.CSSProperties,
|
// style: PropTypes.React.CSSProperties,
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
accessibility: PropTypes.looseBool,
|
accessibility: PropTypes.looseBool,
|
||||||
nextArrow: PropTypes.VNodeChild,
|
nextArrow: PropTypes.any,
|
||||||
prevArrow: PropTypes.VNodeChild,
|
prevArrow: PropTypes.any,
|
||||||
pauseOnHover: PropTypes.looseBool,
|
pauseOnHover: PropTypes.looseBool,
|
||||||
// className: PropTypes.string,
|
// className: PropTypes.string,
|
||||||
adaptiveHeight: PropTypes.looseBool,
|
adaptiveHeight: PropTypes.looseBool,
|
||||||
|
|
|
@ -133,7 +133,7 @@ const cascaderProps = {
|
||||||
type: [Boolean, Object] as PropType<boolean | ShowSearchType | undefined>,
|
type: [Boolean, Object] as PropType<boolean | ShowSearchType | undefined>,
|
||||||
default: undefined as PropType<boolean | ShowSearchType | undefined>,
|
default: undefined as PropType<boolean | ShowSearchType | undefined>,
|
||||||
},
|
},
|
||||||
notFoundContent: PropTypes.VNodeChild,
|
notFoundContent: PropTypes.any,
|
||||||
loadData: PropTypes.func,
|
loadData: PropTypes.func,
|
||||||
/** 次级菜单的展开方式,可选 'click' 和 'hover' */
|
/** 次级菜单的展开方式,可选 'click' 和 'hover' */
|
||||||
expandTrigger: PropTypes.oneOf(tuple('click', 'hover')),
|
expandTrigger: PropTypes.oneOf(tuple('click', 'hover')),
|
||||||
|
@ -147,7 +147,7 @@ const cascaderProps = {
|
||||||
popupVisible: PropTypes.looseBool,
|
popupVisible: PropTypes.looseBool,
|
||||||
fieldNames: { type: Object as PropType<FieldNamesType> },
|
fieldNames: { type: Object as PropType<FieldNamesType> },
|
||||||
autofocus: PropTypes.looseBool,
|
autofocus: PropTypes.looseBool,
|
||||||
suffixIcon: PropTypes.VNodeChild,
|
suffixIcon: PropTypes.any,
|
||||||
showSearchRender: PropTypes.any,
|
showSearchRender: PropTypes.any,
|
||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
onPopupVisibleChange: PropTypes.func,
|
onPopupVisibleChange: PropTypes.func,
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
import type { ExtractPropTypes } from 'vue';
|
import type { ExtractPropTypes } from 'vue';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import PropsTypes from '../_util/vue-types';
|
import PropTypes from '../_util/vue-types';
|
||||||
import { flattenChildren } from '../_util/props-util';
|
import { flattenChildren } from '../_util/props-util';
|
||||||
import type { VueNode } from '../_util/type';
|
import type { VueNode } from '../_util/type';
|
||||||
import { withInstall } from '../_util/type';
|
import { withInstall } from '../_util/type';
|
||||||
import useConfigInject from '../_util/hooks/useConfigInject';
|
import useConfigInject from '../_util/hooks/useConfigInject';
|
||||||
export const commentProps = {
|
export const commentProps = {
|
||||||
actions: PropsTypes.array,
|
actions: PropTypes.array,
|
||||||
/** The element to display as the comment author. */
|
/** The element to display as the comment author. */
|
||||||
author: PropsTypes.VNodeChild,
|
author: PropTypes.any,
|
||||||
/** The element to display as the comment avatar - generally an antd Avatar */
|
/** The element to display as the comment avatar - generally an antd Avatar */
|
||||||
avatar: PropsTypes.VNodeChild,
|
avatar: PropTypes.any,
|
||||||
/** The main content of the comment */
|
/** The main content of the comment */
|
||||||
content: PropsTypes.VNodeChild,
|
content: PropTypes.any,
|
||||||
/** Comment prefix defaults to '.ant-comment' */
|
/** Comment prefix defaults to '.ant-comment' */
|
||||||
prefixCls: PropsTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
/** A datetime element containing the time to be displayed */
|
/** A datetime element containing the time to be displayed */
|
||||||
datetime: PropsTypes.VNodeChild,
|
datetime: PropTypes.any,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CommentProps = Partial<ExtractPropTypes<typeof commentProps>>;
|
export type CommentProps = Partial<ExtractPropTypes<typeof commentProps>>;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { VNodeChild } from 'vue';
|
|
||||||
import { inject } from 'vue';
|
import { inject } from 'vue';
|
||||||
import Empty from '../empty';
|
import Empty from '../empty';
|
||||||
import { defaultConfigProvider } from '.';
|
import { defaultConfigProvider } from '.';
|
||||||
|
import type { VueNode } from '../_util/type';
|
||||||
|
|
||||||
export interface RenderEmptyProps {
|
export interface RenderEmptyProps {
|
||||||
componentName?: string;
|
componentName?: string;
|
||||||
|
@ -31,7 +31,7 @@ const RenderEmpty = (props: RenderEmptyProps) => {
|
||||||
return renderHtml(props.componentName);
|
return renderHtml(props.componentName);
|
||||||
};
|
};
|
||||||
|
|
||||||
function renderEmpty(componentName?: string): VNodeChild | JSX.Element {
|
function renderEmpty(componentName?: string): VueNode {
|
||||||
return <RenderEmpty componentName={componentName} />;
|
return <RenderEmpty componentName={componentName} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ export const DescriptionsItemProps = {
|
||||||
|
|
||||||
const descriptionsItemProp = {
|
const descriptionsItemProp = {
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
label: PropTypes.VNodeChild,
|
label: PropTypes.any,
|
||||||
labelStyle: PropTypes.style,
|
labelStyle: PropTypes.style,
|
||||||
contentStyle: PropTypes.style,
|
contentStyle: PropTypes.style,
|
||||||
span: PropTypes.number.def(1),
|
span: PropTypes.number.def(1),
|
||||||
|
@ -125,8 +125,8 @@ const descriptionsProps = {
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
bordered: PropTypes.looseBool,
|
bordered: PropTypes.looseBool,
|
||||||
size: PropTypes.oneOf(tuple('default', 'middle', 'small')).def('default'),
|
size: PropTypes.oneOf(tuple('default', 'middle', 'small')).def('default'),
|
||||||
title: PropTypes.VNodeChild,
|
title: PropTypes.any,
|
||||||
extra: PropTypes.VNodeChild,
|
extra: PropTypes.any,
|
||||||
column: {
|
column: {
|
||||||
type: [Number, Object] as PropType<number | Partial<Record<Breakpoint, number>>>,
|
type: [Number, Object] as PropType<number | Partial<Record<Breakpoint, number>>>,
|
||||||
default: (): number | Partial<Record<Breakpoint, number>> => DEFAULT_COLUMN_MAP,
|
default: (): number | Partial<Record<Breakpoint, number>> => DEFAULT_COLUMN_MAP,
|
||||||
|
|
|
@ -35,7 +35,7 @@ const defaultPushState: PushState = { distance: 180 };
|
||||||
const drawerProps = () => ({
|
const drawerProps = () => ({
|
||||||
autofocus: PropTypes.looseBool,
|
autofocus: PropTypes.looseBool,
|
||||||
closable: PropTypes.looseBool,
|
closable: PropTypes.looseBool,
|
||||||
closeIcon: PropTypes.VNodeChild,
|
closeIcon: PropTypes.any,
|
||||||
destroyOnClose: PropTypes.looseBool,
|
destroyOnClose: PropTypes.looseBool,
|
||||||
forceRender: PropTypes.looseBool,
|
forceRender: PropTypes.looseBool,
|
||||||
getContainer: PropTypes.any,
|
getContainer: PropTypes.any,
|
||||||
|
@ -55,7 +55,7 @@ const drawerProps = () => ({
|
||||||
headerStyle: PropTypes.object,
|
headerStyle: PropTypes.object,
|
||||||
bodyStyle: PropTypes.object,
|
bodyStyle: PropTypes.object,
|
||||||
contentWrapperStyle: PropTypes.object,
|
contentWrapperStyle: PropTypes.object,
|
||||||
title: PropTypes.VNodeChild,
|
title: PropTypes.any,
|
||||||
visible: PropTypes.looseBool,
|
visible: PropTypes.looseBool,
|
||||||
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||||
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||||
|
@ -64,12 +64,12 @@ const drawerProps = () => ({
|
||||||
push: PropTypes.oneOfType([PropTypes.looseBool, { type: Object as PropType<PushState> }]),
|
push: PropTypes.oneOfType([PropTypes.looseBool, { type: Object as PropType<PushState> }]),
|
||||||
placement: PropTypes.oneOf(PlacementTypes),
|
placement: PropTypes.oneOf(PlacementTypes),
|
||||||
keyboard: PropTypes.looseBool,
|
keyboard: PropTypes.looseBool,
|
||||||
extra: PropTypes.VNodeChild,
|
extra: PropTypes.any,
|
||||||
footer: PropTypes.VNodeChild,
|
footer: PropTypes.any,
|
||||||
footerStyle: PropTypes.object,
|
footerStyle: PropTypes.object,
|
||||||
level: PropTypes.any,
|
level: PropTypes.any,
|
||||||
levelMove: PropTypes.any,
|
levelMove: PropTypes.any,
|
||||||
handle: PropTypes.VNodeChild,
|
handle: PropTypes.any,
|
||||||
/** @deprecated Use `@afterVisibleChange` instead */
|
/** @deprecated Use `@afterVisibleChange` instead */
|
||||||
afterVisibleChange: PropTypes.func,
|
afterVisibleChange: PropTypes.func,
|
||||||
});
|
});
|
||||||
|
|
|
@ -76,9 +76,9 @@ function getPropByPath(obj: any, namePathList: any, strict?: boolean) {
|
||||||
export const formItemProps = {
|
export const formItemProps = {
|
||||||
htmlFor: PropTypes.string,
|
htmlFor: PropTypes.string,
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
label: PropTypes.VNodeChild,
|
label: PropTypes.any,
|
||||||
help: PropTypes.VNodeChild,
|
help: PropTypes.any,
|
||||||
extra: PropTypes.VNodeChild,
|
extra: PropTypes.any,
|
||||||
labelCol: { type: Object as PropType<ColProps> },
|
labelCol: { type: Object as PropType<ColProps> },
|
||||||
wrapperCol: { type: Object as PropType<ColProps> },
|
wrapperCol: { type: Object as PropType<ColProps> },
|
||||||
hasFeedback: PropTypes.looseBool.def(false),
|
hasFeedback: PropTypes.looseBool.def(false),
|
||||||
|
|
|
@ -30,7 +30,7 @@ export const siderProps = {
|
||||||
defaultCollapsed: PropTypes.looseBool,
|
defaultCollapsed: PropTypes.looseBool,
|
||||||
reverseArrow: PropTypes.looseBool,
|
reverseArrow: PropTypes.looseBool,
|
||||||
zeroWidthTriggerStyle: PropTypes.style,
|
zeroWidthTriggerStyle: PropTypes.style,
|
||||||
trigger: PropTypes.VNodeChild,
|
trigger: PropTypes.any,
|
||||||
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||||
collapsedWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
collapsedWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||||
breakpoint: PropTypes.oneOf(tuple('xs', 'sm', 'md', 'lg', 'xl', 'xxl', 'xxxl')),
|
breakpoint: PropTypes.oneOf(tuple('xs', 'sm', 'md', 'lg', 'xl', 'xxl', 'xxxl')),
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { useInjectMenu } from './hooks/useMenuContext';
|
||||||
import { useMeasure } from './hooks/useKeyPath';
|
import { useMeasure } from './hooks/useKeyPath';
|
||||||
|
|
||||||
const menuItemGroupProps = {
|
const menuItemGroupProps = {
|
||||||
title: PropTypes.VNodeChild,
|
title: PropTypes.any,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type MenuItemGroupProps = Partial<ExtractPropTypes<typeof menuItemGroupProps>>;
|
export type MenuItemGroupProps = Partial<ExtractPropTypes<typeof menuItemGroupProps>>;
|
||||||
|
|
|
@ -19,7 +19,7 @@ const menuItemProps = {
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
danger: Boolean,
|
danger: Boolean,
|
||||||
title: { type: [String, Boolean], default: undefined },
|
title: { type: [String, Boolean], default: undefined },
|
||||||
icon: PropTypes.VNodeChild,
|
icon: PropTypes.any,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type MenuItemProps = Partial<ExtractPropTypes<typeof menuItemProps>>;
|
export type MenuItemProps = Partial<ExtractPropTypes<typeof menuItemProps>>;
|
||||||
|
|
|
@ -23,8 +23,8 @@ import isValid from '../../_util/isValid';
|
||||||
let indexGuid = 0;
|
let indexGuid = 0;
|
||||||
|
|
||||||
const subMenuProps = {
|
const subMenuProps = {
|
||||||
icon: PropTypes.VNodeChild,
|
icon: PropTypes.any,
|
||||||
title: PropTypes.VNodeChild,
|
title: PropTypes.any,
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
level: Number,
|
level: Number,
|
||||||
popupClassName: String,
|
popupClassName: String,
|
||||||
|
|
|
@ -14,14 +14,14 @@ import classNames from '../_util/classNames';
|
||||||
import ResizeObserver from '../vc-resize-observer';
|
import ResizeObserver from '../vc-resize-observer';
|
||||||
|
|
||||||
export const pageHeaderProps = {
|
export const pageHeaderProps = {
|
||||||
backIcon: PropTypes.VNodeChild,
|
backIcon: PropTypes.any,
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
title: PropTypes.VNodeChild,
|
title: PropTypes.any,
|
||||||
subTitle: PropTypes.VNodeChild,
|
subTitle: PropTypes.any,
|
||||||
breadcrumb: PropTypes.object,
|
breadcrumb: PropTypes.object,
|
||||||
tags: PropTypes.any,
|
tags: PropTypes.any,
|
||||||
footer: PropTypes.VNodeChild,
|
footer: PropTypes.any,
|
||||||
extra: PropTypes.VNodeChild,
|
extra: PropTypes.any,
|
||||||
avatar: PropTypes.object,
|
avatar: PropTypes.object,
|
||||||
ghost: PropTypes.looseBool,
|
ghost: PropTypes.looseBool,
|
||||||
onBack: PropTypes.func,
|
onBack: PropTypes.func,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type { ExtractPropTypes, PropType, VNodeChild } from 'vue';
|
import type { ExtractPropTypes, PropType } from 'vue';
|
||||||
import { computed, defineComponent } from 'vue';
|
import { computed, defineComponent } from 'vue';
|
||||||
|
import type { VueNode } from '../_util/type';
|
||||||
import PropTypes from '../_util/vue-types';
|
import PropTypes from '../_util/vue-types';
|
||||||
import type { ProgressSize } from './props';
|
import type { ProgressSize } from './props';
|
||||||
import { progressProps } from './props';
|
import { progressProps } from './props';
|
||||||
|
@ -25,7 +26,7 @@ export default defineComponent({
|
||||||
const styledSteps = computed(() => {
|
const styledSteps = computed(() => {
|
||||||
const { steps, strokeWidth = 8, strokeColor, trailColor, prefixCls } = props;
|
const { steps, strokeWidth = 8, strokeColor, trailColor, prefixCls } = props;
|
||||||
|
|
||||||
const temp: VNodeChild[] = [];
|
const temp: VueNode[] = [];
|
||||||
for (let i = 0; i < steps; i += 1) {
|
for (let i = 0; i < steps; i += 1) {
|
||||||
const cls = {
|
const cls = {
|
||||||
[`${prefixCls}-steps-item`]: true,
|
[`${prefixCls}-steps-item`]: true,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import type { VNodeChild } from 'vue';
|
|
||||||
import { computed, defineComponent } from 'vue';
|
import { computed, defineComponent } from 'vue';
|
||||||
import initDefaultProps from '../_util/props-util/initDefaultProps';
|
import initDefaultProps from '../_util/props-util/initDefaultProps';
|
||||||
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
|
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
|
||||||
|
@ -12,6 +11,7 @@ import { getSuccessPercent, validProgress } from './utils';
|
||||||
import useConfigInject from '../_util/hooks/useConfigInject';
|
import useConfigInject from '../_util/hooks/useConfigInject';
|
||||||
import devWarning from '../vc-util/devWarning';
|
import devWarning from '../vc-util/devWarning';
|
||||||
import { progressProps, progressStatuses } from './props';
|
import { progressProps, progressStatuses } from './props';
|
||||||
|
import type { VueNode } from '../_util/type';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'AProgress',
|
name: 'AProgress',
|
||||||
|
@ -67,7 +67,7 @@ export default defineComponent({
|
||||||
const successPercent = getSuccessPercent(props);
|
const successPercent = getSuccessPercent(props);
|
||||||
if (!showInfo) return null;
|
if (!showInfo) return null;
|
||||||
|
|
||||||
let text: VNodeChild;
|
let text: VueNode;
|
||||||
const textFormatter = format || slots?.format || ((val: number) => `${val}%`);
|
const textFormatter = format || slots?.format || ((val: number) => `${val}%`);
|
||||||
const isLineType = type === 'line';
|
const isLineType = type === 'line';
|
||||||
if (
|
if (
|
||||||
|
@ -92,7 +92,7 @@ export default defineComponent({
|
||||||
const { type, steps, strokeColor } = props;
|
const { type, steps, strokeColor } = props;
|
||||||
const progressInfo = renderProcessInfo();
|
const progressInfo = renderProcessInfo();
|
||||||
|
|
||||||
let progress: VNodeChild;
|
let progress: VueNode;
|
||||||
// Render progress shape
|
// Render progress shape
|
||||||
if (type === 'line') {
|
if (type === 'line') {
|
||||||
progress = steps ? (
|
progress = steps ? (
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import PropTypes from '../_util/vue-types';
|
import PropTypes from '../_util/vue-types';
|
||||||
|
import type { VueNode } from '../_util/type';
|
||||||
import { tuple } from '../_util/type';
|
import { tuple } from '../_util/type';
|
||||||
import type { PropType, VNodeChild, ExtractPropTypes } from 'vue';
|
import type { PropType, ExtractPropTypes } from 'vue';
|
||||||
|
|
||||||
export const progressStatuses = tuple('normal', 'exception', 'active', 'success');
|
export const progressStatuses = tuple('normal', 'exception', 'active', 'success');
|
||||||
export type ProgressStatusesType = typeof progressStatuses[number];
|
export type ProgressStatusesType = typeof progressStatuses[number];
|
||||||
|
@ -21,7 +22,7 @@ export const progressProps = () => ({
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
type: PropTypes.oneOf(ProgressType),
|
type: PropTypes.oneOf(ProgressType),
|
||||||
percent: PropTypes.number,
|
percent: PropTypes.number,
|
||||||
format: { type: Function as PropType<(percent?: number, successPercent?: number) => VNodeChild> },
|
format: { type: Function as PropType<(percent?: number, successPercent?: number) => VueNode> },
|
||||||
status: PropTypes.oneOf(progressStatuses),
|
status: PropTypes.oneOf(progressStatuses),
|
||||||
showInfo: PropTypes.looseBool,
|
showInfo: PropTypes.looseBool,
|
||||||
strokeWidth: PropTypes.number,
|
strokeWidth: PropTypes.number,
|
||||||
|
|
|
@ -19,9 +19,9 @@ export const statisticProps = {
|
||||||
valueRender: PropTypes.any,
|
valueRender: PropTypes.any,
|
||||||
formatter: PropTypes.any,
|
formatter: PropTypes.any,
|
||||||
precision: PropTypes.number,
|
precision: PropTypes.number,
|
||||||
prefix: PropTypes.VNodeChild,
|
prefix: PropTypes.any,
|
||||||
suffix: PropTypes.VNodeChild,
|
suffix: PropTypes.any,
|
||||||
title: PropTypes.VNodeChild,
|
title: PropTypes.any,
|
||||||
onFinish: PropTypes.func,
|
onFinish: PropTypes.func,
|
||||||
loading: PropTypes.looseBool,
|
loading: PropTypes.looseBool,
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,8 +18,8 @@ const switchProps = {
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
size: PropTypes.oneOf(SwitchSizes),
|
size: PropTypes.oneOf(SwitchSizes),
|
||||||
disabled: PropTypes.looseBool,
|
disabled: PropTypes.looseBool,
|
||||||
checkedChildren: PropTypes.VNodeChild,
|
checkedChildren: PropTypes.any,
|
||||||
unCheckedChildren: PropTypes.VNodeChild,
|
unCheckedChildren: PropTypes.any,
|
||||||
tabindex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
tabindex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||||
autofocus: PropTypes.looseBool,
|
autofocus: PropTypes.looseBool,
|
||||||
loading: PropTypes.looseBool,
|
loading: PropTypes.looseBool,
|
||||||
|
|
|
@ -19,12 +19,12 @@ const tagProps = {
|
||||||
type: String as PropType<LiteralUnion<PresetColorType | PresetStatusColorType, string>>,
|
type: String as PropType<LiteralUnion<PresetColorType | PresetStatusColorType, string>>,
|
||||||
},
|
},
|
||||||
closable: PropTypes.looseBool.def(false),
|
closable: PropTypes.looseBool.def(false),
|
||||||
closeIcon: PropTypes.VNodeChild,
|
closeIcon: PropTypes.any,
|
||||||
visible: PropTypes.looseBool,
|
visible: PropTypes.looseBool,
|
||||||
onClose: {
|
onClose: {
|
||||||
type: Function as PropType<(e: MouseEvent) => void>,
|
type: Function as PropType<(e: MouseEvent) => void>,
|
||||||
},
|
},
|
||||||
icon: PropTypes.VNodeChild,
|
icon: PropTypes.any,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TagProps = HTMLAttributes & Partial<ExtractPropTypes<typeof tagProps>>;
|
export type TagProps = HTMLAttributes & Partial<ExtractPropTypes<typeof tagProps>>;
|
||||||
|
|
|
@ -34,7 +34,7 @@ export const imageProps = {
|
||||||
wrapperStyle: PropTypes.style,
|
wrapperStyle: PropTypes.style,
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
previewPrefixCls: PropTypes.string,
|
previewPrefixCls: PropTypes.string,
|
||||||
placeholder: PropTypes.VNodeChild,
|
placeholder: PropTypes.any,
|
||||||
fallback: PropTypes.string,
|
fallback: PropTypes.string,
|
||||||
preview: PropTypes.oneOfType([
|
preview: PropTypes.oneOfType([
|
||||||
PropTypes.looseBool,
|
PropTypes.looseBool,
|
||||||
|
|
|
@ -14,7 +14,7 @@ export type PanelBodyProps<DateType> = {
|
||||||
picker?: PanelMode;
|
picker?: PanelMode;
|
||||||
|
|
||||||
// By panel
|
// By panel
|
||||||
headerCells?: VueNode;
|
headerCells?: VueNode[];
|
||||||
rowNum: number;
|
rowNum: number;
|
||||||
colNum: number;
|
colNum: number;
|
||||||
baseDate: DateType;
|
baseDate: DateType;
|
||||||
|
|
|
@ -3,11 +3,12 @@ import PropTypes from '../_util/vue-types';
|
||||||
import { getSlot } from '../_util/props-util';
|
import { getSlot } from '../_util/props-util';
|
||||||
import classNames from '../_util/classNames';
|
import classNames from '../_util/classNames';
|
||||||
import createRef from '../_util/createRef';
|
import createRef from '../_util/createRef';
|
||||||
import type { CSSProperties, VNodeChild } from 'vue';
|
import type { CSSProperties } from 'vue';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import type { RenderDOMFunc } from './interface';
|
import type { RenderDOMFunc } from './interface';
|
||||||
import type { DropdownRender } from './interface/generator';
|
import type { DropdownRender } from './interface/generator';
|
||||||
import type { Placement } from './generate';
|
import type { Placement } from './generate';
|
||||||
|
import type { VueNode } from '../_util/type';
|
||||||
|
|
||||||
const getBuiltInPlacements = (dropdownMatchSelectWidth: number | boolean) => {
|
const getBuiltInPlacements = (dropdownMatchSelectWidth: number | boolean) => {
|
||||||
// Enable horizontal overflow auto-adjustment when a custom dropdown width is provided
|
// Enable horizontal overflow auto-adjustment when a custom dropdown width is provided
|
||||||
|
@ -52,7 +53,7 @@ export interface SelectTriggerProps {
|
||||||
prefixCls: string;
|
prefixCls: string;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
popupElement: VNodeChild | JSX.Element;
|
popupElement: VueNode;
|
||||||
animation?: string;
|
animation?: string;
|
||||||
transitionName?: string;
|
transitionName?: string;
|
||||||
containerWidth: number;
|
containerWidth: number;
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
import { cloneElement } from '../../_util/vnode';
|
import { cloneElement } from '../../_util/vnode';
|
||||||
import type { VNode, VNodeChild } from 'vue';
|
import type { VNode } from 'vue';
|
||||||
import { defineComponent, getCurrentInstance, inject, onMounted, withDirectives } from 'vue';
|
import { defineComponent, getCurrentInstance, inject, onMounted, withDirectives } from 'vue';
|
||||||
import PropTypes from '../../_util/vue-types';
|
import PropTypes from '../../_util/vue-types';
|
||||||
import type { RefObject } from '../../_util/createRef';
|
import type { RefObject } from '../../_util/createRef';
|
||||||
import antInput from '../../_util/antInputDirective';
|
import antInput from '../../_util/antInputDirective';
|
||||||
import classNames from '../../_util/classNames';
|
import classNames from '../../_util/classNames';
|
||||||
import type { EventHandler } from '../../_util/EventInterface';
|
import type { EventHandler } from '../../_util/EventInterface';
|
||||||
|
import type { VueNode } from '../../_util/type';
|
||||||
|
|
||||||
interface InputProps {
|
interface InputProps {
|
||||||
prefixCls: string;
|
prefixCls: string;
|
||||||
id: string;
|
id: string;
|
||||||
inputElement: VNodeChild;
|
inputElement: VueNode;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
autofocus: boolean;
|
autofocus: boolean;
|
||||||
autocomplete: string;
|
autocomplete: string;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import type {
|
||||||
import type { RenderNode } from '../interface';
|
import type { RenderNode } from '../interface';
|
||||||
import type { InnerSelectorProps } from './interface';
|
import type { InnerSelectorProps } from './interface';
|
||||||
import Input from './Input';
|
import Input from './Input';
|
||||||
import type { VNodeChild, Ref, PropType } from 'vue';
|
import type { Ref, PropType } from 'vue';
|
||||||
import { computed, defineComponent, onMounted, ref, watch } from 'vue';
|
import { computed, defineComponent, onMounted, ref, watch } from 'vue';
|
||||||
import classNames from '../../_util/classNames';
|
import classNames from '../../_util/classNames';
|
||||||
import pickAttrs from '../../_util/pickAttrs';
|
import pickAttrs from '../../_util/pickAttrs';
|
||||||
|
@ -24,9 +24,9 @@ type SelectorProps = InnerSelectorProps & {
|
||||||
// Tags
|
// Tags
|
||||||
maxTagCount?: number | 'responsive';
|
maxTagCount?: number | 'responsive';
|
||||||
maxTagTextLength?: number;
|
maxTagTextLength?: number;
|
||||||
maxTagPlaceholder?: VNodeChild | ((omittedValues: LabelValueType[]) => VNodeChild);
|
maxTagPlaceholder?: VueNode | ((omittedValues: LabelValueType[]) => VueNode);
|
||||||
tokenSeparators?: string[];
|
tokenSeparators?: string[];
|
||||||
tagRender?: (props: CustomTagProps) => VNodeChild;
|
tagRender?: (props: CustomTagProps) => VueNode;
|
||||||
onToggleOpen: any;
|
onToggleOpen: any;
|
||||||
|
|
||||||
// Motion
|
// Motion
|
||||||
|
@ -52,7 +52,7 @@ const props = {
|
||||||
accessibilityIndex: PropTypes.number,
|
accessibilityIndex: PropTypes.number,
|
||||||
tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||||
|
|
||||||
removeIcon: PropTypes.VNodeChild,
|
removeIcon: PropTypes.any,
|
||||||
choiceTransitionName: PropTypes.string,
|
choiceTransitionName: PropTypes.string,
|
||||||
|
|
||||||
maxTagCount: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
maxTagCount: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import pickAttrs from '../../_util/pickAttrs';
|
import pickAttrs from '../../_util/pickAttrs';
|
||||||
import Input from './Input';
|
import Input from './Input';
|
||||||
import type { InnerSelectorProps } from './interface';
|
import type { InnerSelectorProps } from './interface';
|
||||||
import type { VNodeChild } from 'vue';
|
|
||||||
import { Fragment, computed, defineComponent, ref, watch } from 'vue';
|
import { Fragment, computed, defineComponent, ref, watch } from 'vue';
|
||||||
import PropTypes from '../../_util/vue-types';
|
import PropTypes from '../../_util/vue-types';
|
||||||
import { useInjectTreeSelectContext } from '../../vc-tree-select/Context';
|
import { useInjectTreeSelectContext } from '../../vc-tree-select/Context';
|
||||||
|
import type { VueNode } from '../../_util/type';
|
||||||
|
|
||||||
interface SelectorProps extends InnerSelectorProps {
|
interface SelectorProps extends InnerSelectorProps {
|
||||||
inputElement: VNodeChild;
|
inputElement: VueNode;
|
||||||
activeValue: string;
|
activeValue: string;
|
||||||
backfill?: boolean;
|
backfill?: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import SingleSelector from './SingleSelector';
|
||||||
import type { LabelValueType, RawValueType, CustomTagProps } from '../interface/generator';
|
import type { LabelValueType, RawValueType, CustomTagProps } from '../interface/generator';
|
||||||
import type { RenderNode, Mode } from '../interface';
|
import type { RenderNode, Mode } from '../interface';
|
||||||
import useLock from '../hooks/useLock';
|
import useLock from '../hooks/useLock';
|
||||||
import type { VNodeChild, PropType } from 'vue';
|
import type { PropType } from 'vue';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import createRef from '../../_util/createRef';
|
import createRef from '../../_util/createRef';
|
||||||
import PropTypes from '../../_util/vue-types';
|
import PropTypes from '../../_util/vue-types';
|
||||||
|
@ -38,14 +38,14 @@ export interface SelectorProps {
|
||||||
accessibilityIndex: number;
|
accessibilityIndex: number;
|
||||||
tabindex?: number | string;
|
tabindex?: number | string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
placeholder?: VNodeChild;
|
placeholder?: VueNode;
|
||||||
removeIcon?: RenderNode;
|
removeIcon?: RenderNode;
|
||||||
|
|
||||||
// Tags
|
// Tags
|
||||||
maxTagCount?: number | 'responsive';
|
maxTagCount?: number | 'responsive';
|
||||||
maxTagTextLength?: number;
|
maxTagTextLength?: number;
|
||||||
maxTagPlaceholder?: VNodeChild | ((omittedValues: LabelValueType[]) => VNodeChild);
|
maxTagPlaceholder?: VueNode | ((omittedValues: LabelValueType[]) => VueNode);
|
||||||
tagRender?: (props: CustomTagProps) => VNodeChild;
|
tagRender?: (props: CustomTagProps) => VueNode;
|
||||||
|
|
||||||
/** Check if `tokenSeparators` contains `\n` or `\r\n` */
|
/** Check if `tokenSeparators` contains `\n` or `\r\n` */
|
||||||
tokenWithEnter?: boolean;
|
tokenWithEnter?: boolean;
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import type { RefObject } from '../../_util/createRef';
|
import type { RefObject } from '../../_util/createRef';
|
||||||
import type { VNodeChild } from 'vue';
|
|
||||||
import type { Mode } from '../interface';
|
import type { Mode } from '../interface';
|
||||||
import type { LabelValueType } from '../interface/generator';
|
import type { LabelValueType } from '../interface/generator';
|
||||||
import type { EventHandler } from '../../_util/EventInterface';
|
import type { EventHandler } from '../../_util/EventInterface';
|
||||||
|
import type { VueNode } from '../../_util/type';
|
||||||
|
|
||||||
export interface InnerSelectorProps {
|
export interface InnerSelectorProps {
|
||||||
prefixCls: string;
|
prefixCls: string;
|
||||||
id: string;
|
id: string;
|
||||||
mode: Mode;
|
mode: Mode;
|
||||||
inputRef: RefObject;
|
inputRef: RefObject;
|
||||||
placeholder?: VNodeChild;
|
placeholder?: VueNode;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
autofocus?: boolean;
|
autofocus?: boolean;
|
||||||
autocomplete?: string;
|
autocomplete?: string;
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import type { FunctionalComponent, VNodeChild } from 'vue';
|
import type { FunctionalComponent } from 'vue';
|
||||||
|
import type { VueNode } from '../_util/type';
|
||||||
import PropTypes from '../_util/vue-types';
|
import PropTypes from '../_util/vue-types';
|
||||||
|
|
||||||
export interface TransBtnProps {
|
export interface TransBtnProps {
|
||||||
class: string;
|
class: string;
|
||||||
customizeIcon: VNodeChild | ((props?: any) => VNodeChild);
|
customizeIcon: VueNode | ((props?: any) => VueNode);
|
||||||
customizeIconProps?: any;
|
customizeIconProps?: any;
|
||||||
onMousedown?: (payload: MouseEvent) => void;
|
onMousedown?: (payload: MouseEvent) => void;
|
||||||
onClick?: (payload: MouseEvent) => void;
|
onClick?: (payload: MouseEvent) => void;
|
||||||
|
@ -15,7 +16,7 @@ export interface TransBtnType extends FunctionalComponent<TransBtnProps> {
|
||||||
|
|
||||||
const TransBtn: TransBtnType = (props, { slots }) => {
|
const TransBtn: TransBtnType = (props, { slots }) => {
|
||||||
const { class: className, customizeIcon, customizeIconProps, onMousedown, onClick } = props;
|
const { class: className, customizeIcon, customizeIconProps, onMousedown, onClick } = props;
|
||||||
let icon: VNodeChild;
|
let icon: VueNode;
|
||||||
|
|
||||||
if (typeof customizeIcon === 'function') {
|
if (typeof customizeIcon === 'function') {
|
||||||
icon = customizeIcon(customizeIconProps);
|
icon = customizeIcon(customizeIconProps);
|
||||||
|
|
|
@ -36,7 +36,7 @@ import { getSeparatedContent } from './utils/valueUtil';
|
||||||
import useSelectTriggerControl from './hooks/useSelectTriggerControl';
|
import useSelectTriggerControl from './hooks/useSelectTriggerControl';
|
||||||
import useCacheDisplayValue from './hooks/useCacheDisplayValue';
|
import useCacheDisplayValue from './hooks/useCacheDisplayValue';
|
||||||
import useCacheOptions from './hooks/useCacheOptions';
|
import useCacheOptions from './hooks/useCacheOptions';
|
||||||
import type { CSSProperties, PropType, VNode, VNodeChild } from 'vue';
|
import type { CSSProperties, PropType, VNode } from 'vue';
|
||||||
import {
|
import {
|
||||||
getCurrentInstance,
|
getCurrentInstance,
|
||||||
computed,
|
computed,
|
||||||
|
@ -54,6 +54,7 @@ import PropTypes from '../_util/vue-types';
|
||||||
import warning from '../_util/warning';
|
import warning from '../_util/warning';
|
||||||
import isMobile from '../vc-util/isMobile';
|
import isMobile from '../vc-util/isMobile';
|
||||||
import { getTextFromElement } from '../_util/props-util';
|
import { getTextFromElement } from '../_util/props-util';
|
||||||
|
import type { VueNode } from '../_util/type';
|
||||||
|
|
||||||
const DEFAULT_OMIT_PROPS = [
|
const DEFAULT_OMIT_PROPS = [
|
||||||
'children',
|
'children',
|
||||||
|
@ -116,9 +117,9 @@ export function selectBaseProps<OptionType, ValueType>() {
|
||||||
allowClear: { type: Boolean, default: undefined },
|
allowClear: { type: Boolean, default: undefined },
|
||||||
clearIcon: PropTypes.any,
|
clearIcon: PropTypes.any,
|
||||||
showArrow: { type: Boolean, default: undefined },
|
showArrow: { type: Boolean, default: undefined },
|
||||||
inputIcon: PropTypes.VNodeChild,
|
inputIcon: PropTypes.any,
|
||||||
removeIcon: PropTypes.VNodeChild,
|
removeIcon: PropTypes.any,
|
||||||
menuItemSelectedIcon: PropTypes.VNodeChild,
|
menuItemSelectedIcon: PropTypes.any,
|
||||||
|
|
||||||
// Dropdown
|
// Dropdown
|
||||||
open: { type: Boolean, default: undefined },
|
open: { type: Boolean, default: undefined },
|
||||||
|
@ -232,7 +233,7 @@ export interface GenerateConfig<OptionType extends object> {
|
||||||
// >;
|
// >;
|
||||||
};
|
};
|
||||||
/** Convert jsx tree into `OptionType[]` */
|
/** Convert jsx tree into `OptionType[]` */
|
||||||
convertChildrenToData: (children: VNodeChild | JSX.Element) => OptionType[];
|
convertChildrenToData: (children: VueNode) => OptionType[];
|
||||||
/** Flatten nest options into raw option list */
|
/** Flatten nest options into raw option list */
|
||||||
flattenOptions: (options: OptionType[], props: any) => FlattenOptionsType<OptionType>;
|
flattenOptions: (options: OptionType[], props: any) => FlattenOptionsType<OptionType>;
|
||||||
/** Convert single raw value into { label, value } format. Will be called by each value */
|
/** Convert single raw value into { label, value } format. Will be called by each value */
|
||||||
|
@ -392,7 +393,7 @@ export default function generateSelector<
|
||||||
const mergedOptions = computed((): OptionType[] => {
|
const mergedOptions = computed((): OptionType[] => {
|
||||||
let newOptions = props.options;
|
let newOptions = props.options;
|
||||||
if (newOptions === undefined) {
|
if (newOptions === undefined) {
|
||||||
newOptions = convertChildrenToData(props.children as VNodeChild);
|
newOptions = convertChildrenToData(props.children as VueNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1057,7 +1058,7 @@ export default function generateSelector<
|
||||||
} = { ...props, ...attrs }; //as SelectProps<OptionType[], ValueType>;
|
} = { ...props, ...attrs }; //as SelectProps<OptionType[], ValueType>;
|
||||||
// ============================= Input ==============================
|
// ============================= Input ==============================
|
||||||
// Only works in `combobox`
|
// Only works in `combobox`
|
||||||
const customizeInputElement: VNodeChild | JSX.Element =
|
const customizeInputElement: VueNode =
|
||||||
(mode === 'combobox' && getInputElement && getInputElement()) || null;
|
(mode === 'combobox' && getInputElement && getInputElement()) || null;
|
||||||
|
|
||||||
const domProps = omitDOMProps ? omitDOMProps(restProps) : restProps;
|
const domProps = omitDOMProps ? omitDOMProps(restProps) : restProps;
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import type { VNode, VNodeChild, CSSProperties } from 'vue';
|
import type { VueNode } from '../../_util/type';
|
||||||
|
import type { VNode, CSSProperties } from 'vue';
|
||||||
import type { Key, RawValueType } from './generator';
|
import type { Key, RawValueType } from './generator';
|
||||||
|
|
||||||
export type RenderDOMFunc = (props: any) => HTMLElement;
|
export type RenderDOMFunc = (props: any) => HTMLElement;
|
||||||
|
|
||||||
export type RenderNode = VNodeChild | ((props: any) => VNodeChild);
|
export type RenderNode = VueNode | ((props: any) => VueNode);
|
||||||
|
|
||||||
export type Mode = 'multiple' | 'tags' | 'combobox';
|
export type Mode = 'multiple' | 'tags' | 'combobox';
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ export interface OptionCoreData {
|
||||||
title?: string;
|
title?: string;
|
||||||
class?: string;
|
class?: string;
|
||||||
style?: CSSProperties;
|
style?: CSSProperties;
|
||||||
label?: VNodeChild;
|
label?: VueNode;
|
||||||
/** @deprecated Only works when use `children` as option data */
|
/** @deprecated Only works when use `children` as option data */
|
||||||
children?: VNode[] | JSX.Element[];
|
children?: VNode[] | JSX.Element[];
|
||||||
}
|
}
|
||||||
|
@ -40,7 +41,7 @@ export interface OptionData extends OptionCoreData {
|
||||||
|
|
||||||
export interface OptionGroupData {
|
export interface OptionGroupData {
|
||||||
key?: Key;
|
key?: Key;
|
||||||
label?: VNodeChild;
|
label?: VueNode;
|
||||||
options: OptionData[];
|
options: OptionData[];
|
||||||
class?: string;
|
class?: string;
|
||||||
style?: CSSProperties;
|
style?: CSSProperties;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { flattenChildren, isValidElement } from '../../_util/props-util';
|
import { flattenChildren, isValidElement } from '../../_util/props-util';
|
||||||
import type { VNode, VNodeChild } from 'vue';
|
import type { VNode } from 'vue';
|
||||||
import type { OptionData, OptionGroupData, OptionsType } from '../interface';
|
import type { OptionData, OptionGroupData, OptionsType } from '../interface';
|
||||||
|
import type { VueNode } from '../../_util/type';
|
||||||
|
|
||||||
function convertNodeToOption(node: VNode): OptionData {
|
function convertNodeToOption(node: VNode): OptionData {
|
||||||
const {
|
const {
|
||||||
|
@ -21,10 +22,7 @@ function convertNodeToOption(node: VNode): OptionData {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function convertChildrenToData(
|
export function convertChildrenToData(nodes: VueNode, optionOnly = false): OptionsType {
|
||||||
nodes: VNodeChild | JSX.Element,
|
|
||||||
optionOnly = false,
|
|
||||||
): OptionsType {
|
|
||||||
const dd = flattenChildren(nodes as [])
|
const dd = flattenChildren(nodes as [])
|
||||||
.map((node: VNode, index: number): OptionData | OptionGroupData | null => {
|
.map((node: VNode, index: number): OptionData | OptionGroupData | null => {
|
||||||
if (!isValidElement(node) || !node.type) {
|
if (!isValidElement(node) || !node.type) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { warning } from '../../vc-util/warning';
|
import { warning } from '../../vc-util/warning';
|
||||||
import type { VNodeChild } from 'vue';
|
|
||||||
import { cloneVNode, isVNode } from 'vue';
|
import { cloneVNode, isVNode } from 'vue';
|
||||||
import type {
|
import type {
|
||||||
OptionsType as SelectOptionsType,
|
OptionsType as SelectOptionsType,
|
||||||
|
@ -17,6 +16,7 @@ import type {
|
||||||
} from '../interface/generator';
|
} from '../interface/generator';
|
||||||
|
|
||||||
import { toArray } from './commonUtil';
|
import { toArray } from './commonUtil';
|
||||||
|
import type { VueNode } from '../../_util/type';
|
||||||
|
|
||||||
function getKey(data: OptionData | OptionGroupData, index: number) {
|
function getKey(data: OptionData | OptionGroupData, index: number) {
|
||||||
const { key } = data;
|
const { key } = data;
|
||||||
|
@ -184,7 +184,7 @@ export const getLabeledValue: GetLabeledValue<FlattenOptionData[]> = (
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
function toRawString(content: VNodeChild): string {
|
function toRawString(content: VueNode): string {
|
||||||
return toArray(content)
|
return toArray(content)
|
||||||
.map(item => {
|
.map(item => {
|
||||||
if (isVNode(item)) {
|
if (isVNode(item)) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { filterEmpty } from '../../_util/props-util';
|
import { filterEmpty } from '../../_util/props-util';
|
||||||
import type { VNodeChild } from 'vue';
|
|
||||||
import { camelize } from 'vue';
|
import { camelize } from 'vue';
|
||||||
import { warning } from '../../vc-util/warning';
|
import { warning } from '../../vc-util/warning';
|
||||||
import type {
|
import type {
|
||||||
|
@ -11,11 +10,12 @@ import type {
|
||||||
LegacyCheckedNode,
|
LegacyCheckedNode,
|
||||||
} from '../interface';
|
} from '../interface';
|
||||||
import TreeNode from '../TreeNode';
|
import TreeNode from '../TreeNode';
|
||||||
|
import type { VueNode } from '../../_util/type';
|
||||||
|
|
||||||
function isTreeSelectNode(node: any) {
|
function isTreeSelectNode(node: any) {
|
||||||
return node && node.type && (node.type as any).isTreeSelectNode;
|
return node && node.type && (node.type as any).isTreeSelectNode;
|
||||||
}
|
}
|
||||||
export function convertChildrenToData(rootNodes: VNodeChild): DataNode[] {
|
export function convertChildrenToData(rootNodes: VueNode): DataNode[] {
|
||||||
function dig(treeNodes: any[] = []): DataNode[] {
|
function dig(treeNodes: any[] = []): DataNode[] {
|
||||||
return filterEmpty(treeNodes).map(treeNode => {
|
return filterEmpty(treeNodes).map(treeNode => {
|
||||||
// Filter invalidate node
|
// Filter invalidate node
|
||||||
|
|
|
@ -111,7 +111,7 @@ export const treeProps = () => ({
|
||||||
prefixCls: String,
|
prefixCls: String,
|
||||||
focusable: { type: Boolean, default: undefined },
|
focusable: { type: Boolean, default: undefined },
|
||||||
tabindex: Number,
|
tabindex: Number,
|
||||||
children: PropTypes.VNodeChild,
|
children: PropTypes.any,
|
||||||
treeData: { type: Array as PropType<DataNode[]> }, // Generate treeNode by children
|
treeData: { type: Array as PropType<DataNode[]> }, // Generate treeNode by children
|
||||||
fieldNames: { type: Object as PropType<FieldNames> },
|
fieldNames: { type: Object as PropType<FieldNames> },
|
||||||
showLine: { type: Boolean, default: undefined },
|
showLine: { type: Boolean, default: undefined },
|
||||||
|
|
|
@ -10,11 +10,11 @@ import type {
|
||||||
} from '../interface';
|
} from '../interface';
|
||||||
import { getPosition, isTreeNode } from '../util';
|
import { getPosition, isTreeNode } from '../util';
|
||||||
import { warning } from '../../vc-util/warning';
|
import { warning } from '../../vc-util/warning';
|
||||||
import type { VNodeChild } from 'vue';
|
|
||||||
import { camelize } from 'vue';
|
import { camelize } from 'vue';
|
||||||
import type { TreeNodeProps } from '../props';
|
import type { TreeNodeProps } from '../props';
|
||||||
import { filterEmpty } from '../../_util/props-util';
|
import { filterEmpty } from '../../_util/props-util';
|
||||||
import omit from '../../_util/omit';
|
import omit from '../../_util/omit';
|
||||||
|
import type { VueNode } from '../../_util/type';
|
||||||
|
|
||||||
export function getKey(key: Key, pos: string) {
|
export function getKey(key: Key, pos: string) {
|
||||||
if (key !== null && key !== undefined) {
|
if (key !== null && key !== undefined) {
|
||||||
|
@ -65,8 +65,8 @@ export function warningWithoutKey(treeData: DataNode[], fieldNames: FieldNames)
|
||||||
/**
|
/**
|
||||||
* Convert `children` of Tree into `treeData` structure.
|
* Convert `children` of Tree into `treeData` structure.
|
||||||
*/
|
*/
|
||||||
export function convertTreeToData(rootNodes: VNodeChild): DataNode[] {
|
export function convertTreeToData(rootNodes: VueNode): DataNode[] {
|
||||||
function dig(node: VNodeChild = []): DataNode[] {
|
function dig(node: VueNode = []): DataNode[] {
|
||||||
const treeNodes = filterEmpty(node as NodeElement[]);
|
const treeNodes = filterEmpty(node as NodeElement[]);
|
||||||
return treeNodes.map(treeNode => {
|
return treeNodes.map(treeNode => {
|
||||||
// Filter invalidate node
|
// Filter invalidate node
|
||||||
|
|
Loading…
Reference in New Issue