fix: update components type (#3165)
parent
4ab7a681a7
commit
f3063e00c0
|
@ -10,8 +10,8 @@ import warning from '../_util/warning';
|
|||
|
||||
const { Option, OptGroup } = Select;
|
||||
|
||||
function isSelectOptionOrSelectOptGroup(child: any): Boolean {
|
||||
return child && child.type && (child.type.isSelectOption || child.type.isSelectOptGroup);
|
||||
function isSelectOptionOrSelectOptGroup(child: any): boolean {
|
||||
return child?.type?.isSelectOption || child?.type?.isSelectOptGroup;
|
||||
}
|
||||
|
||||
const AutoCompleteProps = {
|
||||
|
@ -83,12 +83,12 @@ const AutoComplete = defineComponent({
|
|||
|
||||
render() {
|
||||
const { size, prefixCls: customizePrefixCls, dataSource } = this;
|
||||
let optionChildren: any;
|
||||
let optionChildren: VNode[];
|
||||
const { getPrefixCls } = this.configProvider;
|
||||
const prefixCls = getPrefixCls('select', customizePrefixCls);
|
||||
const { class: className } = this.$attrs as any;
|
||||
const { class: className } = this.$attrs;
|
||||
const cls = {
|
||||
[className]: !!className,
|
||||
[className as string]: !!className,
|
||||
[`${prefixCls}-lg`]: size === 'large',
|
||||
[`${prefixCls}-sm`]: size === 'small',
|
||||
[`${prefixCls}-show-search`]: true,
|
||||
|
|
|
@ -161,12 +161,7 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
render() {
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
title,
|
||||
component: Tag = 'sup' as any,
|
||||
displayComponent,
|
||||
} = this;
|
||||
const { prefixCls: customizePrefixCls, title, component: Tag = 'sup', displayComponent } = this;
|
||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('scroll-number', customizePrefixCls);
|
||||
const { class: className, style = {} } = this.$attrs as {
|
||||
|
|
|
@ -161,7 +161,7 @@ function defaultSortFilteredOption(
|
|||
inputValue: string,
|
||||
names: FilledFieldNamesType,
|
||||
) {
|
||||
function callback(elem) {
|
||||
function callback(elem: CascaderOptionType) {
|
||||
return elem[names.label].indexOf(inputValue) > -1;
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ const Cascader = defineComponent({
|
|||
},
|
||||
|
||||
handleInputChange(e: Event) {
|
||||
const inputValue = (e.target as any).value;
|
||||
const inputValue = (e.target as HTMLInputElement).value;
|
||||
this.setState({ inputValue });
|
||||
this.$emit('search', inputValue);
|
||||
},
|
||||
|
|
|
@ -60,9 +60,9 @@ export default defineComponent({
|
|||
const { prefixCls: customizePrefixCls, bordered, expandIconPosition } = this;
|
||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('collapse', customizePrefixCls);
|
||||
const { class: className, ...restAttrs } = this.$attrs as any;
|
||||
const { class: className, ...restAttrs } = this.$attrs;
|
||||
const collapseClassName = {
|
||||
[className]: className,
|
||||
[className as string]: className,
|
||||
[`${prefixCls}-borderless`]: !bordered,
|
||||
[`${prefixCls}-icon-position-${expandIconPosition}`]: true,
|
||||
};
|
||||
|
|
|
@ -31,9 +31,9 @@ export default defineComponent({
|
|||
const { prefixCls: customizePrefixCls, showArrow = true } = this;
|
||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('collapse', customizePrefixCls);
|
||||
const { class: className, ...restAttrs } = this.$attrs as any;
|
||||
const { class: className, ...restAttrs } = this.$attrs;
|
||||
const collapsePanelClassName = {
|
||||
[className]: className,
|
||||
[className as string]: className,
|
||||
[`${prefixCls}-no-arrow`]: !showArrow,
|
||||
};
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ const Drawer = defineComponent({
|
|||
const handler = getComponent(this, 'handle') || false;
|
||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||
const prefixCls = getPrefixCls('drawer', customizePrefixCls);
|
||||
const { class: className } = this.$attrs as any;
|
||||
const { class: className } = this.$attrs;
|
||||
const vcDrawerProps: any = {
|
||||
...this.$attrs,
|
||||
...omit(rest, [
|
||||
|
@ -253,7 +253,7 @@ const Drawer = defineComponent({
|
|||
showMask: mask,
|
||||
placement,
|
||||
class: classnames({
|
||||
[className]: !!className,
|
||||
[className as string]: !!className,
|
||||
[wrapClassName]: !!wrapClassName,
|
||||
[haveMask]: !!haveMask,
|
||||
}),
|
||||
|
|
|
@ -52,7 +52,7 @@ export const FormProps = {
|
|||
prefixCls: PropTypes.string,
|
||||
hideRequiredMark: PropTypes.looseBool,
|
||||
model: PropTypes.object,
|
||||
rules: { type: Object as PropType<{[k: string]: ValidationRule[] | ValidationRule}> },
|
||||
rules: { type: Object as PropType<{ [k: string]: ValidationRule[] | ValidationRule }> },
|
||||
validateMessages: PropTypes.object,
|
||||
validateOnRuleChange: PropTypes.looseBool,
|
||||
// 提交失败自动滚动到第一个错误字段
|
||||
|
@ -63,7 +63,7 @@ export const FormProps = {
|
|||
validateTrigger: { type: [String, Array] as PropType<string | string[]> },
|
||||
};
|
||||
|
||||
function isEqualName(name1: any, name2: any) {
|
||||
function isEqualName(name1: NamePath, name2: NamePath) {
|
||||
return isEqual(toArray(name1), toArray(name2));
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ const ResizableTextArea = defineComponent({
|
|||
saveTextArea(textArea: HTMLTextAreaElement) {
|
||||
this.textArea = textArea;
|
||||
},
|
||||
handleResize(size: any) {
|
||||
handleResize(size: { width: number; height: number }) {
|
||||
const { resizeStatus } = this.$data;
|
||||
|
||||
if (resizeStatus !== RESIZE_STATUS_NONE) {
|
||||
|
|
|
@ -120,7 +120,7 @@ export default function calculateNodeHeight(
|
|||
let minHeight = Number.MIN_SAFE_INTEGER;
|
||||
let maxHeight = Number.MAX_SAFE_INTEGER;
|
||||
let height = hiddenTextarea.scrollHeight;
|
||||
let overflowY: any;
|
||||
let overflowY: string;
|
||||
|
||||
if (boxSizing === 'border-box') {
|
||||
// border-box: add border, since height = content + padding + border
|
||||
|
|
Loading…
Reference in New Issue