Skip to content

Commit 13e1db0

Browse files
committed
chore: type support [email protected]
1 parent fdf76b9 commit 13e1db0

File tree

38 files changed

+66
-55
lines changed

38 files changed

+66
-55
lines changed

components/alert/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ const Alert = defineComponent({
168168
<div
169169
role="alert"
170170
{...attrs}
171-
style={[attrs.style, motionStyle.value]}
171+
style={[attrs.style as CSSProperties, motionStyle.value]}
172172
v-show={!closing.value}
173173
class={[attrs.class, alertCls]}
174174
data-show={!closing.value}

components/avatar/Avatar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ const Avatar = defineComponent({
203203
{...attrs}
204204
ref={avatarNodeRef}
205205
class={classString}
206-
style={[sizeStyle, responsiveSizeStyle(!!icon), attrs.style]}
206+
style={[sizeStyle, responsiveSizeStyle(!!icon), attrs.style as CSSProperties]}
207207
>
208208
{childrenToRender}
209209
</span>

components/avatar/Group.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ const Group = defineComponent({
7171
</Popover>,
7272
);
7373
return (
74-
<div {...attrs} class={cls} style={attrs.style}>
74+
<div {...attrs} class={cls} style={attrs.style as CSSProperties}>
7575
{childrenShow}
7676
</div>
7777
);
7878
}
7979

8080
return (
81-
<div {...attrs} class={cls} style={attrs.style}>
81+
<div {...attrs} class={cls} style={attrs.style as CSSProperties}>
8282
{childrenWithProps}
8383
</div>
8484
);

components/breadcrumb/BreadcrumbItem.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ExtractPropTypes, PropType } from 'vue';
1+
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
22
import { defineComponent } from 'vue';
33
import PropTypes from '../_util/vue-types';
44
import { getPropsSlot } from '../_util/props-util';
@@ -66,7 +66,7 @@ export default defineComponent({
6666
link = renderBreadcrumbNode(link, prefixCls.value);
6767
if (children) {
6868
return (
69-
<span class={cls} style={style}>
69+
<span class={cls} style={style as CSSProperties}>
7070
{link}
7171
{separator && <span class={`${prefixCls.value}-separator`}>{separator}</span>}
7272
</span>

components/carousel/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ExtractPropTypes, PropType } from 'vue';
1+
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
22
import { ref, computed, watchEffect, defineComponent } from 'vue';
33
import PropTypes from '../_util/vue-types';
44
import warning from '../_util/warning';
@@ -127,7 +127,7 @@ const Carousel = defineComponent({
127127
[`${cls}`]: !!cls,
128128
});
129129
return (
130-
<div class={className} style={style}>
130+
<div class={className} style={style as CSSProperties}>
131131
<SlickCarousel
132132
ref={slickRef}
133133
{...props}

components/checkbox/Checkbox.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { CSSProperties } from 'vue';
12
import { watchEffect, onMounted, defineComponent, inject, onBeforeUnmount, ref } from 'vue';
23
import classNames from '../_util/classNames';
34
import VcCheckbox from '../vc-checkbox/Checkbox';
@@ -93,7 +94,7 @@ export default defineComponent({
9394
return (
9495
<label
9596
class={classString}
96-
style={style}
97+
style={style as CSSProperties}
9798
onMouseenter={onMouseenter as EventHandler}
9899
onMouseleave={onMouseleave as EventHandler}
99100
>

components/collapse/Collapse.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { cloneElement } from '../_util/vnode';
88
import type { CollapsibleType } from './commonProps';
99
import { collapseProps } from './commonProps';
1010
import { getDataAndAriaProps } from '../_util/util';
11-
import type { ExtractPropTypes } from 'vue';
11+
import type { CSSProperties, ExtractPropTypes } from 'vue';
1212
import { computed, defineComponent, ref, watch } from 'vue';
1313
import RightOutlined from '@ant-design/icons-vue/RightOutlined';
1414
import firstNotUndefined from '../_util/firstNotUndefined';
@@ -173,7 +173,7 @@ export default defineComponent({
173173
<div
174174
class={collapseClassName}
175175
{...getDataAndAriaProps(attrs)}
176-
style={attrs.style}
176+
style={attrs.style as CSSProperties}
177177
role={accordion ? 'tablist' : null}
178178
>
179179
{getItems()}

components/dropdown/dropdown-button.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ExtractPropTypes } from 'vue';
1+
import type { ExtractPropTypes, HTMLAttributes } from 'vue';
22
import { defineComponent } from 'vue';
33
import Button from '../button';
44
import classNames from '../_util/classNames';
@@ -54,7 +54,7 @@ export default defineComponent({
5454
onClick,
5555
'onUpdate:visible': _updateVisible,
5656
...restProps
57-
} = { ...props, ...attrs };
57+
} = { ...props, ...attrs } as DropdownButtonProps & HTMLAttributes;
5858

5959
const dropdownProps = {
6060
align,

components/input-number/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const InputNumber = defineComponent({
9494
prefix = slots.prefix?.(),
9595
valueModifiers = {},
9696
...others
97-
} = { ...(attrs as HTMLAttributes), ...props };
97+
} = { ...attrs, ...props } as InputNumberProps & HTMLAttributes;
9898

9999
const preCls = prefixCls.value;
100100

components/input/ClearableLabeledInput.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import classNames from '../_util/classNames';
22
import CloseCircleFilled from '@ant-design/icons-vue/CloseCircleFilled';
33
import PropTypes from '../_util/vue-types';
44
import { cloneElement } from '../_util/vnode';
5-
import type { PropType, VNode } from 'vue';
5+
import type { CSSProperties, PropType, VNode } from 'vue';
66
import { ref, defineComponent } from 'vue';
77
import { tuple } from '../_util/type';
88
import type { Direction, SizeType } from '../config-provider';
@@ -121,7 +121,7 @@ export default defineComponent({
121121
<span
122122
ref={containerRef}
123123
class={affixWrapperCls}
124-
style={attrs.style}
124+
style={attrs.style as CSSProperties}
125125
onMouseup={onInputMouseUp}
126126
hidden={hidden}
127127
>
@@ -173,7 +173,7 @@ export default defineComponent({
173173
// Need another wrapper for changing display:table to display:inline-block
174174
// and put style prop in wrapper
175175
return (
176-
<span class={mergedGroupClassName} style={attrs.style} hidden={hidden}>
176+
<span class={mergedGroupClassName} style={attrs.style as CSSProperties} hidden={hidden}>
177177
<span class={mergedWrapperClassName}>
178178
{addonBeforeNode}
179179
{cloneElement(labeledElement, { style: null })}
@@ -209,7 +209,7 @@ export default defineComponent({
209209
},
210210
);
211211
return (
212-
<span class={affixWrapperCls} style={attrs.style} hidden={hidden}>
212+
<span class={affixWrapperCls} style={attrs.style as CSSProperties} hidden={hidden}>
213213
{cloneElement(element, {
214214
style: null,
215215
value,

components/input/ResizableTextArea.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ const ResizableTextArea = defineComponent({
125125
if (!textareaProps.autofocus) {
126126
delete textareaProps.autofocus;
127127
}
128+
if (textareaProps.rows === 0) {
129+
delete textareaProps.rows;
130+
}
128131
return (
129132
<ResizeObserver onResize={handleResize} disabled={!(autoSize || autosize)}>
130133
{withDirectives((<textarea {...textareaProps} ref={textAreaRef} />) as VNode, [

components/input/TextArea.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { CSSProperties } from 'vue';
12
import {
23
computed,
34
defineComponent,
@@ -281,7 +282,7 @@ export default defineComponent({
281282
`${prefixCls.value}-textarea-show-count`,
282283
customClass,
283284
)}
284-
style={style}
285+
style={style as CSSProperties}
285286
data-count={typeof dataCount !== 'object' ? dataCount : undefined}
286287
>
287288
{textareaNode}

components/layout/Sider.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export default defineComponent({
194194
)
195195
: null;
196196
const divStyle = [
197-
attrs.style,
197+
attrs.style as CSSProperties,
198198
{
199199
flex: `0 0 ${siderWidth}`,
200200
maxWidth: siderWidth, // Fix width transition bug in IE11

components/menu/src/Menu.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export default defineComponent({
323323
const storeValue = store.value;
324324
eventKeys.forEach(eventKey => {
325325
const { key, childrenEventKeys } = storeValue[eventKey];
326-
keys.push(key, ...getChildrenKeys(childrenEventKeys));
326+
keys.push(key, ...getChildrenKeys(unref(childrenEventKeys)));
327327
});
328328
return keys;
329329
};
@@ -345,7 +345,7 @@ export default defineComponent({
345345
newOpenKeys.push(key);
346346
} else if (mergedMode.value !== 'inline') {
347347
// We need find all related popup to close
348-
const subPathKeys = getChildrenKeys(childrenEventKeys);
348+
const subPathKeys = getChildrenKeys(unref(childrenEventKeys));
349349
newOpenKeys = uniq(newOpenKeys.filter(k => !subPathKeys.includes(k)));
350350
}
351351

components/menu/src/hooks/useMenuContext.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Key } from '../../../_util/type';
2-
import type { ComputedRef, InjectionKey, PropType, Ref, UnwrapRef } from 'vue';
2+
import type { ComputedRef, InjectionKey, PropType, Ref } from 'vue';
33
import { defineComponent, inject, provide, toRef } from 'vue';
44
import type {
55
BuiltinPlacements,
@@ -21,7 +21,7 @@ export interface StoreMenuInfo {
2121
export interface MenuContextProps {
2222
isRootMenu: Ref<boolean>;
2323

24-
store: Ref<Record<string, UnwrapRef<StoreMenuInfo>>>;
24+
store: Ref<Record<string, StoreMenuInfo>>;
2525
registerMenuInfo: (key: string, info: StoreMenuInfo) => void;
2626
unRegisterMenuInfo: (key: string) => void;
2727
prefixCls: ComputedRef<string>;

components/rate/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ExtractPropTypes, PropType, VNode } from 'vue';
1+
import type { CSSProperties, ExtractPropTypes, PropType, VNode } from 'vue';
22
import { watch, defineComponent, ref, reactive, onMounted } from 'vue';
33
import { initDefaultProps, getPropsSlot, findDOMNode } from '../_util/props-util';
44
import { withInstall } from '../_util/type';
@@ -230,7 +230,7 @@ const Rate = defineComponent({
230230
{...attrs}
231231
id={id}
232232
class={rateClassName}
233-
style={style}
233+
style={style as CSSProperties}
234234
onMouseleave={disabled ? null : onMouseLeave}
235235
tabindex={disabled ? -1 : tabindex}
236236
onFocus={disabled ? null : onFocus}

components/table/Table.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import scrollTo from '../_util/scrollTo';
3434
import defaultLocale from '../locale/en_US';
3535
import type { SizeType } from '../config-provider';
3636
import devWarning from '../vc-util/devWarning';
37-
import type { PropType } from 'vue';
37+
import type { CSSProperties, PropType } from 'vue';
3838
import { nextTick, reactive, ref, computed, defineComponent, toRef, watchEffect, watch } from 'vue';
3939
import type { DefaultRecordType } from '../vc-table/interface';
4040
import useBreakpoint from '../_util/hooks/useBreakpoint';
@@ -636,7 +636,7 @@ const InteralTable = defineComponent<
636636
);
637637
const tableProps = omit(props, ['columns']);
638638
return (
639-
<div class={wrapperClassNames} style={attrs.style}>
639+
<div class={wrapperClassNames} style={attrs.style as CSSProperties}>
640640
<Spin spinning={false} {...spinProps}>
641641
{topPaginationNode}
642642
<RcTable

components/tabs/src/TabNavList/AddButton.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { PropType } from 'vue';
1+
import type { CSSProperties, PropType } from 'vue';
22
import { defineComponent, ref } from 'vue';
33
import type { EditableConfig, TabsLocale } from '../interface';
44

@@ -32,7 +32,7 @@ export default defineComponent({
3232
ref={domRef}
3333
type="button"
3434
class={`${prefixCls}-nav-add`}
35-
style={attrs.style}
35+
style={attrs.style as CSSProperties}
3636
aria-label={locale?.addAriaLabel || 'Add tab'}
3737
onClick={event => {
3838
editable.onEdit('add', {

components/tabs/src/TabNavList/OperationNode.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,10 @@ export default defineComponent({
224224
);
225225

226226
return (
227-
<div class={classNames(`${prefixCls}-nav-operations`, attrs.class)} style={attrs.style}>
227+
<div
228+
class={classNames(`${prefixCls}-nav-operations`, attrs.class)}
229+
style={attrs.style as CSSProperties}
230+
>
228231
{moreNode}
229232
<AddButton prefixCls={prefixCls} locale={locale} editable={editable} />
230233
</div>

components/tabs/src/TabNavList/TabNode.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Tab, EditableConfig } from '../interface';
2-
import type { PropType } from 'vue';
2+
import type { CSSProperties, PropType } from 'vue';
33
import { defineComponent, computed, ref } from 'vue';
44
import type { FocusEventHandler } from '../../../_util/EventInterface';
55
import KeyCode from '../../../_util/KeyCode';
@@ -88,7 +88,7 @@ export default defineComponent({
8888
[`${tabPrefix}-active`]: active,
8989
[`${tabPrefix}-disabled`]: disabled,
9090
})}
91-
style={attrs.style}
91+
style={attrs.style as CSSProperties}
9292
onClick={onInternalClick}
9393
>
9494
{/* Primary Tab Button */}

components/tabs/src/TabNavList/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ export default defineComponent({
464464
<div
465465
role="tablist"
466466
class={classNames(`${pre}-nav`, className)}
467-
style={style}
467+
style={style as CSSProperties}
468468
onKeydown={() => {
469469
// No need animation when use keyboard
470470
doLockAnimation();

components/tabs/src/TabPanelList/TabPane.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default defineComponent({
6363
tabindex={active ? 0 : -1}
6464
aria-labelledby={id && `${id}-tab-${tabKey}`}
6565
aria-hidden={!active}
66-
style={[mergedStyle.value, attrs.style]}
66+
style={[mergedStyle.value, attrs.style as CSSProperties]}
6767
class={[`${prefixCls}-tabpane`, active && `${prefixCls}-tabpane-active`, attrs.class]}
6868
>
6969
{(active || visited.value || forceRender) && slots.default?.()}

components/transfer/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ const Transfer = defineComponent({
344344
const rightTitle =
345345
(titles && titles[1]) ?? slots.rightTitle?.() ?? (locale.titles || ['', ''])[1];
346346
return (
347-
<div class={cls} style={style} id={id}>
347+
<div class={cls} style={style as CSSProperties} id={id}>
348348
<List
349349
key="leftList"
350350
prefixCls={`${prefixCls.value}-list`}

components/transfer/list.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Menu from '../menu';
77
import Dropdown from '../dropdown';
88
import Search from './search';
99
import ListBody from './ListBody';
10-
import type { VNode, VNodeTypes, ExtractPropTypes, PropType } from 'vue';
10+
import type { VNode, VNodeTypes, ExtractPropTypes, PropType, CSSProperties } from 'vue';
1111
import { watchEffect, computed, defineComponent, ref } from 'vue';
1212
import type { RadioChangeEvent } from '../radio/interface';
1313
import type { TransferDirection, TransferItem } from './index';
@@ -388,7 +388,7 @@ export default defineComponent({
388388
);
389389

390390
return (
391-
<div class={listCls} style={attrs.style}>
391+
<div class={listCls} style={attrs.style as CSSProperties}>
392392
<div class={`${prefixCls}-header`}>
393393
{showSelectAll ? (
394394
<>

components/upload/Upload.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ export default defineComponent({
383383
onDrop={onFileDrop}
384384
onDragover={onFileDrop}
385385
onDragleave={onFileDrop}
386-
style={attrs.style}
386+
style={attrs.style as CSSProperties}
387387
>
388388
<VcUpload
389389
{...rcUploadProps}

components/upload/UploadList/ListItem.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export default defineComponent({
266266
);
267267

268268
return (
269-
<div class={listContainerNameClass} style={style} ref={ref}>
269+
<div class={listContainerNameClass} style={style as CSSProperties} ref={ref}>
270270
{itemRender
271271
? itemRender({
272272
originNode: item,

components/vc-dialog/Content.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export default defineComponent({
137137
v-show={visible}
138138
key="dialog-element"
139139
role="document"
140-
style={[contentStyleRef.value, attrs.style]}
140+
style={[contentStyleRef.value, attrs.style as CSSProperties]}
141141
class={[prefixCls, attrs.class]}
142142
onMousedown={onMousedown}
143143
onMouseup={onMouseup}

components/vc-mentions/src/Mentions.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ExtractPropTypes } from 'vue';
1+
import type { CSSProperties, ExtractPropTypes } from 'vue';
22
import {
33
toRef,
44
watchEffect,
@@ -278,7 +278,7 @@ export default defineComponent({
278278
onPressenter: onPressEnter,
279279
};
280280
return (
281-
<div class={classNames(prefixCls, className)} style={style}>
281+
<div class={classNames(prefixCls, className)} style={style as CSSProperties}>
282282
{withDirectives(<textarea ref={textarea} {...textareaProps} />, [[antInputDirective]])}
283283
{measuring && (
284284
<div ref={measure} class={`${prefixCls}-measure`}>

0 commit comments

Comments
 (0)