Merge remote-tracking branch 'origin/main' into feat-v3.3

pull/5820/head
tangjinzhou 2022-05-21 15:14:29 +08:00
commit 8ad9317d11
45 changed files with 88 additions and 58 deletions

View File

@ -1,5 +1,6 @@
import type { UnwrapRef } from 'vue'; import type { UnwrapRef } from 'vue';
import { reactive, toRef } from 'vue'; import { reactive, toRef } from 'vue';
import fromPairs from 'lodash-es/fromPairs';
/** /**
* Reactively pick fields from a reactive object * Reactively pick fields from a reactive object
@ -10,5 +11,5 @@ export function reactivePick<T extends object, K extends keyof T>(
obj: T, obj: T,
...keys: K[] ...keys: K[]
): { [S in K]: UnwrapRef<T[S]> } { ): { [S in K]: UnwrapRef<T[S]> } {
return reactive(Object.fromEntries(keys.map(k => [k, toRef(obj, k)]))) as any; return reactive(fromPairs(keys.map(k => [k, toRef(obj, k)]))) as any;
} }

View File

@ -168,7 +168,7 @@ const Alert = defineComponent({
<div <div
role="alert" role="alert"
{...attrs} {...attrs}
style={[attrs.style, motionStyle.value]} style={[attrs.style as CSSProperties, motionStyle.value]}
v-show={!closing.value} v-show={!closing.value}
class={[attrs.class, alertCls]} class={[attrs.class, alertCls]}
data-show={!closing.value} data-show={!closing.value}

View File

@ -203,7 +203,7 @@ const Avatar = defineComponent({
{...attrs} {...attrs}
ref={avatarNodeRef} ref={avatarNodeRef}
class={classString} class={classString}
style={[sizeStyle, responsiveSizeStyle(!!icon), attrs.style]} style={[sizeStyle, responsiveSizeStyle(!!icon), attrs.style as CSSProperties]}
> >
{childrenToRender} {childrenToRender}
</span> </span>

View File

@ -71,14 +71,14 @@ const Group = defineComponent({
</Popover>, </Popover>,
); );
return ( return (
<div {...attrs} class={cls} style={attrs.style}> <div {...attrs} class={cls} style={attrs.style as CSSProperties}>
{childrenShow} {childrenShow}
</div> </div>
); );
} }
return ( return (
<div {...attrs} class={cls} style={attrs.style}> <div {...attrs} class={cls} style={attrs.style as CSSProperties}>
{childrenWithProps} {childrenWithProps}
</div> </div>
); );

View File

@ -1,4 +1,4 @@
import type { ExtractPropTypes, PropType } from 'vue'; import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { getPropsSlot } from '../_util/props-util'; import { getPropsSlot } from '../_util/props-util';
@ -66,7 +66,7 @@ export default defineComponent({
link = renderBreadcrumbNode(link, prefixCls.value); link = renderBreadcrumbNode(link, prefixCls.value);
if (children) { if (children) {
return ( return (
<li class={cls} style={style}> <li class={cls} style={style as CSSProperties}>
{link} {link}
{separator && <span class={`${prefixCls.value}-separator`}>{separator}</span>} {separator && <span class={`${prefixCls.value}-separator`}>{separator}</span>}
</li> </li>

View File

@ -1,4 +1,4 @@
import type { ExtractPropTypes, PropType } from 'vue'; import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
import { ref, computed, watchEffect, defineComponent } from 'vue'; import { ref, computed, watchEffect, defineComponent } from 'vue';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import warning from '../_util/warning'; import warning from '../_util/warning';
@ -127,7 +127,7 @@ const Carousel = defineComponent({
[`${cls}`]: !!cls, [`${cls}`]: !!cls,
}); });
return ( return (
<div class={className} style={style}> <div class={className} style={style as CSSProperties}>
<SlickCarousel <SlickCarousel
ref={slickRef} ref={slickRef}
{...props} {...props}

View File

@ -1,3 +1,4 @@
import type { CSSProperties } from 'vue';
import { watchEffect, onMounted, defineComponent, inject, onBeforeUnmount, ref } from 'vue'; import { watchEffect, onMounted, defineComponent, inject, onBeforeUnmount, ref } from 'vue';
import classNames from '../_util/classNames'; import classNames from '../_util/classNames';
import VcCheckbox from '../vc-checkbox/Checkbox'; import VcCheckbox from '../vc-checkbox/Checkbox';
@ -96,7 +97,7 @@ export default defineComponent({
return ( return (
<label <label
class={classString} class={classString}
style={style} style={style as CSSProperties}
onMouseenter={onMouseenter as EventHandler} onMouseenter={onMouseenter as EventHandler}
onMouseleave={onMouseleave as EventHandler} onMouseleave={onMouseleave as EventHandler}
> >

View File

@ -8,7 +8,7 @@ import { cloneElement } from '../_util/vnode';
import type { CollapsibleType } from './commonProps'; import type { CollapsibleType } from './commonProps';
import { collapseProps } from './commonProps'; import { collapseProps } from './commonProps';
import { getDataAndAriaProps } from '../_util/util'; import { getDataAndAriaProps } from '../_util/util';
import type { ExtractPropTypes } from 'vue'; import type { CSSProperties, ExtractPropTypes } from 'vue';
import { computed, defineComponent, ref, watch } from 'vue'; import { computed, defineComponent, ref, watch } from 'vue';
import RightOutlined from '@ant-design/icons-vue/RightOutlined'; import RightOutlined from '@ant-design/icons-vue/RightOutlined';
import firstNotUndefined from '../_util/firstNotUndefined'; import firstNotUndefined from '../_util/firstNotUndefined';
@ -173,7 +173,7 @@ export default defineComponent({
<div <div
class={collapseClassName} class={collapseClassName}
{...getDataAndAriaProps(attrs)} {...getDataAndAriaProps(attrs)}
style={attrs.style} style={attrs.style as CSSProperties}
role={accordion ? 'tablist' : null} role={accordion ? 'tablist' : null}
> >
{getItems()} {getItems()}

View File

@ -283,7 +283,7 @@ const Drawer = defineComponent({
return ( return (
closable && ( closable && (
<button key="closer" onClick={close} aria-label="Close" class={`${prefixCls}-close`}> <button key="closer" onClick={close} aria-label="Close" class={`${prefixCls}-close`}>
{$closeIcon === undefined ? <CloseOutlined></CloseOutlined> : null} {$closeIcon === undefined ? <CloseOutlined></CloseOutlined> : $closeIcon}
</button> </button>
) )
); );

View File

@ -1,4 +1,4 @@
import type { ExtractPropTypes } from 'vue'; import type { ExtractPropTypes, HTMLAttributes } from 'vue';
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import Button from '../button'; import Button from '../button';
import classNames from '../_util/classNames'; import classNames from '../_util/classNames';
@ -54,7 +54,7 @@ export default defineComponent({
onClick, onClick,
'onUpdate:visible': _updateVisible, 'onUpdate:visible': _updateVisible,
...restProps ...restProps
} = { ...props, ...attrs }; } = { ...props, ...attrs } as DropdownButtonProps & HTMLAttributes;
const dropdownProps = { const dropdownProps = {
align, align,

View File

@ -104,7 +104,7 @@ const InputNumber = defineComponent({
prefix = slots.prefix?.(), prefix = slots.prefix?.(),
valueModifiers = {}, valueModifiers = {},
...others ...others
} = { ...(attrs as HTMLAttributes), ...props }; } = { ...attrs, ...props } as InputNumberProps & HTMLAttributes;
const preCls = prefixCls.value; const preCls = prefixCls.value;

View File

@ -2,7 +2,7 @@ import classNames from '../_util/classNames';
import CloseCircleFilled from '@ant-design/icons-vue/CloseCircleFilled'; import CloseCircleFilled from '@ant-design/icons-vue/CloseCircleFilled';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { cloneElement } from '../_util/vnode'; import { cloneElement } from '../_util/vnode';
import type { PropType, VNode } from 'vue'; import type { CSSProperties, PropType, VNode } from 'vue';
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { tuple } from '../_util/type'; import { tuple } from '../_util/type';
import type { Direction, SizeType } from '../config-provider'; import type { Direction, SizeType } from '../config-provider';
@ -97,7 +97,7 @@ export default defineComponent({
}, },
); );
return ( return (
<span className={affixWrapperCls} style={attrs.style} hidden={hidden}> <span class={affixWrapperCls} style={attrs.style as CSSProperties} hidden={hidden}>
{cloneElement(element, { {cloneElement(element, {
style: null, style: null,
value, value,

View File

@ -125,6 +125,9 @@ const ResizableTextArea = defineComponent({
if (!textareaProps.autofocus) { if (!textareaProps.autofocus) {
delete textareaProps.autofocus; delete textareaProps.autofocus;
} }
if (textareaProps.rows === 0) {
delete textareaProps.rows;
}
return ( return (
<ResizeObserver onResize={handleResize} disabled={!(autoSize || autosize)}> <ResizeObserver onResize={handleResize} disabled={!(autoSize || autosize)}>
{withDirectives((<textarea {...textareaProps} ref={textAreaRef} />) as VNode, [ {withDirectives((<textarea {...textareaProps} ref={textAreaRef} />) as VNode, [

View File

@ -1,3 +1,4 @@
import type { CSSProperties } from 'vue';
import { import {
computed, computed,
defineComponent, defineComponent,
@ -290,7 +291,7 @@ export default defineComponent({
`${prefixCls.value}-textarea-show-count`, `${prefixCls.value}-textarea-show-count`,
customClass, customClass,
)} )}
style={style} style={style as CSSProperties}
data-count={typeof dataCount !== 'object' ? dataCount : undefined} data-count={typeof dataCount !== 'object' ? dataCount : undefined}
> >
{textareaNode} {textareaNode}

View File

@ -194,7 +194,7 @@ export default defineComponent({
) )
: null; : null;
const divStyle = [ const divStyle = [
attrs.style, attrs.style as CSSProperties,
{ {
flex: `0 0 ${siderWidth}`, flex: `0 0 ${siderWidth}`,
maxWidth: siderWidth, // Fix width transition bug in IE11 maxWidth: siderWidth, // Fix width transition bug in IE11

View File

@ -355,7 +355,7 @@ export default defineComponent({
newOpenKeys.push(key); newOpenKeys.push(key);
} else if (mergedMode.value !== 'inline') { } else if (mergedMode.value !== 'inline') {
// We need find all related popup to close // We need find all related popup to close
const subPathKeys = getChildrenKeys(childrenEventKeys); const subPathKeys = getChildrenKeys(unref(childrenEventKeys));
newOpenKeys = uniq(newOpenKeys.filter(k => !subPathKeys.includes(k))); newOpenKeys = uniq(newOpenKeys.filter(k => !subPathKeys.includes(k)));
} }

View File

@ -1,4 +1,4 @@
import type { ExtractPropTypes, PropType, VNode } from 'vue'; import type { CSSProperties, ExtractPropTypes, PropType, VNode } from 'vue';
import { watch, defineComponent, ref, reactive, onMounted } from 'vue'; import { watch, defineComponent, ref, reactive, onMounted } from 'vue';
import { initDefaultProps, getPropsSlot, findDOMNode } from '../_util/props-util'; import { initDefaultProps, getPropsSlot, findDOMNode } from '../_util/props-util';
import { withInstall } from '../_util/type'; import { withInstall } from '../_util/type';
@ -230,7 +230,7 @@ const Rate = defineComponent({
{...attrs} {...attrs}
id={id} id={id}
class={rateClassName} class={rateClassName}
style={style} style={style as CSSProperties}
onMouseleave={disabled ? null : onMouseLeave} onMouseleave={disabled ? null : onMouseLeave}
tabindex={disabled ? -1 : tabindex} tabindex={disabled ? -1 : tabindex}
onFocus={disabled ? null : onFocus} onFocus={disabled ? null : onFocus}

View File

@ -3,7 +3,7 @@ import { defineComponent, onBeforeUnmount, onMounted, onUpdated, ref } from 'vue
import omit from '../_util/omit'; import omit from '../_util/omit';
import initDefaultProps from '../_util/props-util/initDefaultProps'; import initDefaultProps from '../_util/props-util/initDefaultProps';
import Statistic, { statisticProps } from './Statistic'; import Statistic, { statisticProps } from './Statistic';
import type { countdownValueType, FormatConfig } from './utils'; import type { countdownValueType, FormatConfig, valueType } from './utils';
import { formatCountdown as formatCD } from './utils'; import { formatCountdown as formatCD } from './utils';
const REFRESH_INTERVAL = 1000 / 30; const REFRESH_INTERVAL = 1000 / 30;
@ -14,7 +14,7 @@ function getTime(value?: countdownValueType) {
export const countdownProps = () => { export const countdownProps = () => {
return { return {
...statisticProps(), ...statisticProps(),
value: [Number, String], value: [Number, String, Object] as PropType<countdownValueType>,
format: String, format: String,
onFinish: Function as PropType<() => void>, onFinish: Function as PropType<() => void>,
onChange: Function as PropType<(value?: countdownValueType) => void>, onChange: Function as PropType<(value?: countdownValueType) => void>,
@ -88,11 +88,13 @@ export default defineComponent({
stopTimer(); stopTimer();
}); });
return () => { return () => {
const value = props.value as valueType;
return ( return (
<Statistic <Statistic
ref={statistic} ref={statistic}
{...{ {...{
...omit(props, ['onFinish', 'onChange']), ...omit(props, ['onFinish', 'onChange']),
value,
valueRender: valueRenderHtml, valueRender: valueRenderHtml,
formatter: formatCountdown, formatter: formatCountdown,
}} }}

View File

@ -3,7 +3,7 @@ import { defineComponent } from 'vue';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import initDefaultProps from '../_util/props-util/initDefaultProps'; import initDefaultProps from '../_util/props-util/initDefaultProps';
import StatisticNumber from './Number'; import StatisticNumber from './Number';
import type { countdownValueType } from './utils'; import type { valueType } from './utils';
import Skeleton from '../skeleton/Skeleton'; import Skeleton from '../skeleton/Skeleton';
import useConfigInject from '../_util/hooks/useConfigInject'; import useConfigInject from '../_util/hooks/useConfigInject';
@ -13,7 +13,7 @@ export const statisticProps = () => ({
groupSeparator: String, groupSeparator: String,
format: String, format: String,
value: { value: {
type: [String, Number, Object] as PropType<countdownValueType>, type: [String, Number, Object] as PropType<valueType>,
}, },
valueStyle: { type: Object as PropType<CSSProperties>, default: undefined as CSSProperties }, valueStyle: { type: Object as PropType<CSSProperties>, default: undefined as CSSProperties },
valueRender: PropTypes.any, valueRender: PropTypes.any,

View File

@ -2,7 +2,7 @@ import type { VNodeTypes } from 'vue';
import padStart from 'lodash-es/padStart'; import padStart from 'lodash-es/padStart';
export type valueType = number | string; export type valueType = number | string;
export type countdownValueType = valueType | string; export type countdownValueType = valueType | Date;
export type Formatter = export type Formatter =
| false | false

View File

@ -34,7 +34,7 @@ import scrollTo from '../_util/scrollTo';
import defaultLocale from '../locale/en_US'; import defaultLocale from '../locale/en_US';
import type { SizeType } from '../config-provider'; import type { SizeType } from '../config-provider';
import devWarning from '../vc-util/devWarning'; import devWarning from '../vc-util/devWarning';
import type { PropType } from 'vue'; import type { CSSProperties, PropType } from 'vue';
import { nextTick, reactive, ref, computed, defineComponent, toRef, watchEffect, watch } from 'vue'; import { nextTick, reactive, ref, computed, defineComponent, toRef, watchEffect, watch } from 'vue';
import type { DefaultRecordType } from '../vc-table/interface'; import type { DefaultRecordType } from '../vc-table/interface';
import useBreakpoint from '../_util/hooks/useBreakpoint'; import useBreakpoint from '../_util/hooks/useBreakpoint';
@ -636,7 +636,7 @@ const InteralTable = defineComponent<
); );
const tableProps = omit(props, ['columns']); const tableProps = omit(props, ['columns']);
return ( return (
<div class={wrapperClassNames} style={attrs.style}> <div class={wrapperClassNames} style={attrs.style as CSSProperties}>
<Spin spinning={false} {...spinProps}> <Spin spinning={false} {...spinProps}>
{topPaginationNode} {topPaginationNode}
<RcTable <RcTable

View File

@ -1,4 +1,4 @@
import type { PropType } from 'vue'; import type { CSSProperties, PropType } from 'vue';
import { defineComponent, ref } from 'vue'; import { defineComponent, ref } from 'vue';
import type { EditableConfig, TabsLocale } from '../interface'; import type { EditableConfig, TabsLocale } from '../interface';
@ -32,7 +32,7 @@ export default defineComponent({
ref={domRef} ref={domRef}
type="button" type="button"
class={`${prefixCls}-nav-add`} class={`${prefixCls}-nav-add`}
style={attrs.style} style={attrs.style as CSSProperties}
aria-label={locale?.addAriaLabel || 'Add tab'} aria-label={locale?.addAriaLabel || 'Add tab'}
onClick={event => { onClick={event => {
editable.onEdit('add', { editable.onEdit('add', {

View File

@ -224,7 +224,10 @@ export default defineComponent({
); );
return ( return (
<div class={classNames(`${prefixCls}-nav-operations`, attrs.class)} style={attrs.style}> <div
class={classNames(`${prefixCls}-nav-operations`, attrs.class)}
style={attrs.style as CSSProperties}
>
{moreNode} {moreNode}
<AddButton prefixCls={prefixCls} locale={locale} editable={editable} /> <AddButton prefixCls={prefixCls} locale={locale} editable={editable} />
</div> </div>

View File

@ -1,5 +1,5 @@
import type { Tab, EditableConfig } from '../interface'; import type { Tab, EditableConfig } from '../interface';
import type { PropType } from 'vue'; import type { CSSProperties, PropType } from 'vue';
import { defineComponent, computed, ref } from 'vue'; import { defineComponent, computed, ref } from 'vue';
import type { FocusEventHandler } from '../../../_util/EventInterface'; import type { FocusEventHandler } from '../../../_util/EventInterface';
import KeyCode from '../../../_util/KeyCode'; import KeyCode from '../../../_util/KeyCode';
@ -88,7 +88,7 @@ export default defineComponent({
[`${tabPrefix}-active`]: active, [`${tabPrefix}-active`]: active,
[`${tabPrefix}-disabled`]: disabled, [`${tabPrefix}-disabled`]: disabled,
})} })}
style={attrs.style} style={attrs.style as CSSProperties}
onClick={onInternalClick} onClick={onInternalClick}
> >
{/* Primary Tab Button */} {/* Primary Tab Button */}

View File

@ -464,7 +464,7 @@ export default defineComponent({
<div <div
role="tablist" role="tablist"
class={classNames(`${pre}-nav`, className)} class={classNames(`${pre}-nav`, className)}
style={style} style={style as CSSProperties}
onKeydown={() => { onKeydown={() => {
// No need animation when use keyboard // No need animation when use keyboard
doLockAnimation(); doLockAnimation();

View File

@ -63,7 +63,7 @@ export default defineComponent({
tabindex={active ? 0 : -1} tabindex={active ? 0 : -1}
aria-labelledby={id && `${id}-tab-${tabKey}`} aria-labelledby={id && `${id}-tab-${tabKey}`}
aria-hidden={!active} aria-hidden={!active}
style={[mergedStyle.value, attrs.style]} style={[mergedStyle.value, attrs.style as CSSProperties]}
class={[`${prefixCls}-tabpane`, active && `${prefixCls}-tabpane-active`, attrs.class]} class={[`${prefixCls}-tabpane`, active && `${prefixCls}-tabpane-active`, attrs.class]}
> >
{(active || visited.value || forceRender) && slots.default?.()} {(active || visited.value || forceRender) && slots.default?.()}

View File

@ -344,7 +344,7 @@ const Transfer = defineComponent({
const rightTitle = const rightTitle =
(titles && titles[1]) ?? slots.rightTitle?.() ?? (locale.titles || ['', ''])[1]; (titles && titles[1]) ?? slots.rightTitle?.() ?? (locale.titles || ['', ''])[1];
return ( return (
<div class={cls} style={style} id={id}> <div class={cls} style={style as CSSProperties} id={id}>
<List <List
key="leftList" key="leftList"
prefixCls={`${prefixCls.value}-list`} prefixCls={`${prefixCls.value}-list`}

View File

@ -7,7 +7,7 @@ import Menu from '../menu';
import Dropdown from '../dropdown'; import Dropdown from '../dropdown';
import Search from './search'; import Search from './search';
import ListBody from './ListBody'; import ListBody from './ListBody';
import type { VNode, VNodeTypes, ExtractPropTypes, PropType } from 'vue'; import type { VNode, VNodeTypes, ExtractPropTypes, PropType, CSSProperties } from 'vue';
import { watchEffect, computed, defineComponent, ref } from 'vue'; import { watchEffect, computed, defineComponent, ref } from 'vue';
import type { RadioChangeEvent } from '../radio/interface'; import type { RadioChangeEvent } from '../radio/interface';
import type { TransferDirection, TransferItem } from './index'; import type { TransferDirection, TransferItem } from './index';
@ -388,7 +388,7 @@ export default defineComponent({
); );
return ( return (
<div class={listCls} style={attrs.style}> <div class={listCls} style={attrs.style as CSSProperties}>
<div class={`${prefixCls}-header`}> <div class={`${prefixCls}-header`}>
{showSelectAll ? ( {showSelectAll ? (
<> <>

View File

@ -5,7 +5,7 @@ import VcTree from '../vc-tree';
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { filterEmpty } from '../_util/props-util'; import { filterEmpty } from '../_util/props-util';
import initDefaultProps from '../_util/props-util/initDefaultProps'; import initDefaultProps from '../_util/props-util/initDefaultProps';
import type { DataNode, EventDataNode, FieldNames, Key } from '../vc-tree/interface'; import type { DataNode, EventDataNode, FieldNames, Key, ScrollTo } from '../vc-tree/interface';
import type { TreeNodeProps } from '../vc-tree/props'; import type { TreeNodeProps } from '../vc-tree/props';
import { treeProps as vcTreeProps } from '../vc-tree/props'; import { treeProps as vcTreeProps } from '../vc-tree/props';
import useConfigInject from '../_util/hooks/useConfigInject'; import useConfigInject from '../_util/hooks/useConfigInject';
@ -168,11 +168,15 @@ export default defineComponent({
); );
const { prefixCls, direction, virtual } = useConfigInject('tree', props); const { prefixCls, direction, virtual } = useConfigInject('tree', props);
const treeRef = ref(); const treeRef = ref();
const scrollTo: ScrollTo = scroll => {
treeRef.value?.scrollTo(scroll);
};
expose({ expose({
treeRef, treeRef,
onNodeExpand: (...args) => { onNodeExpand: (...args) => {
treeRef.value?.onNodeExpand(...args); treeRef.value?.onNodeExpand(...args);
}, },
scrollTo,
selectedKeys: computed(() => treeRef.value?.selectedKeys), selectedKeys: computed(() => treeRef.value?.selectedKeys),
checkedKeys: computed(() => treeRef.value?.checkedKeys), checkedKeys: computed(() => treeRef.value?.checkedKeys),
halfCheckedKeys: computed(() => treeRef.value?.halfCheckedKeys), halfCheckedKeys: computed(() => treeRef.value?.halfCheckedKeys),

View File

@ -56,6 +56,12 @@ Almost anything can be represented in a tree structure. Examples include directo
| rightClick | Callback function for when the user right clicks a treeNode | function({event, node}) | | rightClick | Callback function for when the user right clicks a treeNode | function({event, node}) |
| select | Callback function for when the user clicks a treeNode | function(selectedKeys, e:{selected: bool, selectedNodes, node, event}) | | select | Callback function for when the user clicks a treeNode | function(selectedKeys, e:{selected: bool, selectedNodes, node, event}) |
### Tree Methods
| Name | Description |
| --- | --- |
| scrollTo({ key: string \| number; align?: 'top' \| 'bottom' \| 'auto'; offset?: number }) | Scroll to key item in virtual scroll |
### TreeNode ### TreeNode
| Property | Description | Type | Default | Version | | Property | Description | Type | Default | Version |

View File

@ -57,6 +57,12 @@ cover: https://gw.alipayobjects.com/zos/alicdn/Xh-oWqg9k/Tree.svg
| rightClick | 响应右键点击 | function({event, node}) | | rightClick | 响应右键点击 | function({event, node}) |
| select | 点击树节点触发 | function(selectedKeys, e:{selected: bool, selectedNodes, node, event}) | | select | 点击树节点触发 | function(selectedKeys, e:{selected: bool, selectedNodes, node, event}) |
### Tree 方法
| 名称 | 说明 |
| --- | --- |
| scrollTo({ key: string \| number; align?: 'top' \| 'bottom' \| 'auto'; offset?: number }) | 虚拟滚动下,滚动到指定 key 条目 |
### TreeNode ### TreeNode
| 参数 | 说明 | 类型 | 默认值 | 版本 | | 参数 | 说明 | 类型 | 默认值 | 版本 |

View File

@ -383,7 +383,7 @@ export default defineComponent({
onDrop={onFileDrop} onDrop={onFileDrop}
onDragover={onFileDrop} onDragover={onFileDrop}
onDragleave={onFileDrop} onDragleave={onFileDrop}
style={attrs.style} style={attrs.style as CSSProperties}
> >
<VcUpload <VcUpload
{...rcUploadProps} {...rcUploadProps}

View File

@ -266,7 +266,7 @@ export default defineComponent({
); );
return ( return (
<div class={listContainerNameClass} style={style} ref={ref}> <div class={listContainerNameClass} style={style as CSSProperties} ref={ref}>
{itemRender {itemRender
? itemRender({ ? itemRender({
originNode: item, originNode: item,

View File

@ -137,7 +137,7 @@ export default defineComponent({
v-show={visible} v-show={visible}
key="dialog-element" key="dialog-element"
role="document" role="document"
style={[contentStyleRef.value, attrs.style]} style={[contentStyleRef.value, attrs.style as CSSProperties]}
class={[prefixCls, attrs.class]} class={[prefixCls, attrs.class]}
onMousedown={onMousedown} onMousedown={onMousedown}
onMouseup={onMouseup} onMouseup={onMouseup}

View File

@ -1,4 +1,4 @@
import type { ExtractPropTypes } from 'vue'; import type { CSSProperties, ExtractPropTypes } from 'vue';
import { import {
toRef, toRef,
watchEffect, watchEffect,
@ -278,7 +278,7 @@ export default defineComponent({
onPressenter: onPressEnter, onPressenter: onPressEnter,
}; };
return ( return (
<div class={classNames(prefixCls, className)} style={style}> <div class={classNames(prefixCls, className)} style={style as CSSProperties}>
{withDirectives(<textarea ref={textarea} {...textareaProps} />, [[antInputDirective]])} {withDirectives(<textarea ref={textarea} {...textareaProps} />, [[antInputDirective]])}
{measuring && ( {measuring && (
<div ref={measure} class={`${prefixCls}-measure`}> <div ref={measure} class={`${prefixCls}-measure`}>

View File

@ -1,6 +1,6 @@
import type { Key } from '../_util/type'; import type { Key } from '../_util/type';
import { Teleport, computed, defineComponent, onMounted, watch, onUnmounted } from 'vue'; import { Teleport, computed, defineComponent, onMounted, watch, onUnmounted } from 'vue';
import type { HTMLAttributes } from 'vue'; import type { HTMLAttributes, CSSProperties } from 'vue';
import type { MouseEventHandler } from '../_util/EventInterface'; import type { MouseEventHandler } from '../_util/EventInterface';
import classNames from '../_util/classNames'; import classNames from '../_util/classNames';
@ -113,7 +113,7 @@ export default defineComponent<NoticeProps>({
class={classNames(componentClass, className, { class={classNames(componentClass, className, {
[`${componentClass}-closable`]: closable, [`${componentClass}-closable`]: closable,
})} })}
style={style} style={style as CSSProperties}
onMouseenter={clearCloseTimer} onMouseenter={clearCloseTimer}
onMouseleave={startCloseTimer} onMouseleave={startCloseTimer}
onClick={onClick} onClick={onClick}

View File

@ -179,7 +179,7 @@ const Notification = defineComponent<NotificationProps>({
<div <div
class={className} class={className}
style={ style={
attrs.style || { (attrs.style as CSSProperties) || {
top: '65px', top: '65px',
left: '50%', left: '50%',
} }

View File

@ -1,5 +1,6 @@
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import classNames from '../_util/classNames'; import classNames from '../_util/classNames';
import type { CSSProperties } from 'vue';
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
export default defineComponent({ export default defineComponent({
@ -52,7 +53,7 @@ export default defineComponent({
title={showTitle ? String(page) : null} title={showTitle ? String(page) : null}
tabindex="0" tabindex="0"
class={cls} class={cls}
style={style} style={style as CSSProperties}
> >
{itemRender({ {itemRender({
page, page,

View File

@ -592,7 +592,7 @@ function Picker<DateType>() {
[`${prefixCls}-focused`]: focused.value, [`${prefixCls}-focused`]: focused.value,
[`${prefixCls}-rtl`]: direction === 'rtl', [`${prefixCls}-rtl`]: direction === 'rtl',
})} })}
style={attrs.style} style={attrs.style as CSSProperties}
onMousedown={onMousedown} onMousedown={onMousedown}
onMouseup={onInternalMouseup} onMouseup={onInternalMouseup}
onMouseenter={onMouseenter} onMouseenter={onMouseenter}

View File

@ -33,6 +33,7 @@ import getExtraFooter from './utils/getExtraFooter';
import getRanges from './utils/getRanges'; import getRanges from './utils/getRanges';
import { getLowerBoundTime, setDateTime, setTime } from './utils/timeUtil'; import { getLowerBoundTime, setDateTime, setTime } from './utils/timeUtil';
import type { VueNode } from '../_util/type'; import type { VueNode } from '../_util/type';
import type { CSSProperties } from 'vue';
import { computed, createVNode, defineComponent, ref, toRef, watch, watchEffect } from 'vue'; import { computed, createVNode, defineComponent, ref, toRef, watch, watchEffect } from 'vue';
import useMergedState from '../_util/hooks/useMergedState'; import useMergedState from '../_util/hooks/useMergedState';
import { warning } from '../vc-util/warning'; import { warning } from '../vc-util/warning';
@ -596,7 +597,7 @@ function PickerPanel<DateType>() {
<div <div
tabindex={tabindex} tabindex={tabindex}
class={classNames(classString.value, attrs.class)} class={classNames(classString.value, attrs.class)}
style={attrs.style} style={attrs.style as CSSProperties}
onKeydown={onInternalKeydown} onKeydown={onInternalKeydown}
onBlur={onInternalBlur} onBlur={onInternalBlur}
onMousedown={onMousedown} onMousedown={onMousedown}

View File

@ -1,4 +1,4 @@
import type { PropType } from 'vue'; import type { CSSProperties, PropType } from 'vue';
import { computed, defineComponent, ref, onMounted, onBeforeUnmount } from 'vue'; import { computed, defineComponent, ref, onMounted, onBeforeUnmount } from 'vue';
import classNames from '../../_util/classNames'; import classNames from '../../_util/classNames';
import PropTypes from '../../_util/vue-types'; import PropTypes from '../../_util/vue-types';
@ -108,7 +108,7 @@ export default defineComponent({
'aria-valuenow': value, 'aria-valuenow': value,
'aria-disabled': !!disabled, 'aria-disabled': !!disabled,
}; };
const elStyle = [attrs.style, positionStyle.value]; const elStyle = [attrs.style as CSSProperties, positionStyle.value];
let mergedTabIndex = tabindex || 0; let mergedTabIndex = tabindex || 0;
if (disabled || tabindex === null) { if (disabled || tabindex === null) {
mergedTabIndex = null; mergedTabIndex = null;

View File

@ -837,7 +837,7 @@ export default defineComponent<TableProps<DefaultRecordType>>({
flattenColumns.value[columnCount.value - 1].fixed === 'right', flattenColumns.value[columnCount.value - 1].fixed === 'right',
[attrs.class as string]: attrs.class, [attrs.class as string]: attrs.class,
})} })}
style={attrs.style} style={attrs.style as CSSProperties}
id={id} id={id}
ref={fullTableRef} ref={fullTableRef}
> >

View File

@ -1,6 +1,7 @@
import { useInjectKeysState, useInjectTreeContext } from './contextTypes'; import { useInjectKeysState, useInjectTreeContext } from './contextTypes';
import Indent from './Indent'; import Indent from './Indent';
import { convertNodePropsToEventData, getTreeNodeProps } from './utils/treeUtil'; import { convertNodePropsToEventData, getTreeNodeProps } from './utils/treeUtil';
import type { CSSProperties } from 'vue';
import { import {
computed, computed,
defineComponent, defineComponent,
@ -556,7 +557,7 @@ export default defineComponent({
'drag-over-gap-bottom': !disabled && dragOverGapBottom.value, 'drag-over-gap-bottom': !disabled && dragOverGapBottom.value,
'filter-node': filterTreeNode && filterTreeNode(eventData.value), 'filter-node': filterTreeNode && filterTreeNode(eventData.value),
})} })}
style={attrs.style} style={attrs.style as CSSProperties}
// Draggable config // Draggable config
draggable={draggableWithoutDisabled} draggable={draggableWithoutDisabled}
aria-grabbed={dragging} aria-grabbed={dragging}

View File

@ -152,7 +152,7 @@ export default defineComponent({
statusValue === 'motion' || statusValue === 'stable' || !visible.value ? null : 0, statusValue === 'motion' || statusValue === 'stable' || !visible.value ? null : 0,
pointerEvents: statusValue === 'stable' ? null : 'none', pointerEvents: statusValue === 'stable' ? null : 'none',
}, },
attrs.style, attrs.style as CSSProperties,
]; ];
let childNode: any = flattenChildren(slots.default?.({ visible: props.visible })); let childNode: any = flattenChildren(slots.default?.({ visible: props.visible }));

View File

@ -254,7 +254,7 @@
"vue-router": "^4.0.0", "vue-router": "^4.0.0",
"vue-server-renderer": "^2.6.11", "vue-server-renderer": "^2.6.11",
"vue-style-loader": "^4.1.2", "vue-style-loader": "^4.1.2",
"vue-tsc": "^0.30.2", "vue-tsc": "^0.34.15",
"vuex": "^4.0.0-beta.2", "vuex": "^4.0.0-beta.2",
"webpack": "^5.0.0", "webpack": "^5.0.0",
"webpack-bundle-analyzer": "^4.4.2", "webpack-bundle-analyzer": "^4.4.2",