fix: update EventHandlerNonNull to EventHandler
parent
1f34aed666
commit
3fd9f9ae71
|
@ -0,0 +1,10 @@
|
||||||
|
export type FocusEventHandler = (e: FocusEvent) => void;
|
||||||
|
export type MouseEventHandler = (e: MouseEvent) => void;
|
||||||
|
export type KeyboardEventHandler = (e: KeyboardEvent) => void;
|
||||||
|
export type ChangeEvent = Event & {
|
||||||
|
target: {
|
||||||
|
value?: string | undefined;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type EventHandler = (...args: any[]) => void;
|
|
@ -6,6 +6,7 @@ import hasProp, { getOptionProps, getSlot } from '../_util/props-util';
|
||||||
import { defaultConfigProvider } from '../config-provider';
|
import { defaultConfigProvider } from '../config-provider';
|
||||||
import warning from '../_util/warning';
|
import warning from '../_util/warning';
|
||||||
import type { RadioChangeEvent } from '../radio/interface';
|
import type { RadioChangeEvent } from '../radio/interface';
|
||||||
|
import type { EventHandler } from '../_util/EventInterface';
|
||||||
function noop() {}
|
function noop() {}
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -127,8 +128,8 @@ export default defineComponent({
|
||||||
<label
|
<label
|
||||||
class={classString}
|
class={classString}
|
||||||
style={style}
|
style={style}
|
||||||
onMouseenter={onMouseenter as EventHandlerNonNull}
|
onMouseenter={onMouseenter as EventHandler}
|
||||||
onMouseleave={onMouseleave as EventHandlerNonNull}
|
onMouseleave={onMouseleave as EventHandler}
|
||||||
>
|
>
|
||||||
<VcCheckbox {...checkboxProps} class={checkboxClass} ref="vcCheckbox" />
|
<VcCheckbox {...checkboxProps} class={checkboxClass} ref="vcCheckbox" />
|
||||||
{children.length ? <span>{children}</span> : null}
|
{children.length ? <span>{children}</span> : null}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type moment from 'moment';
|
import type moment from 'moment';
|
||||||
import type { CSSProperties } from 'vue';
|
import type { CSSProperties } from 'vue';
|
||||||
|
import type { EventHandler } from '../_util/EventInterface';
|
||||||
import type { VueNode } from '../_util/type';
|
import type { VueNode } from '../_util/type';
|
||||||
import { tuple } from '../_util/type';
|
import { tuple } from '../_util/type';
|
||||||
|
|
||||||
|
@ -37,8 +38,8 @@ export interface PickerProps {
|
||||||
disabledDate?: (current: moment.Moment | null) => boolean;
|
disabledDate?: (current: moment.Moment | null) => boolean;
|
||||||
dateRender?: (current: moment.Moment, today: moment.Moment) => any;
|
dateRender?: (current: moment.Moment, today: moment.Moment) => any;
|
||||||
autofocus?: boolean;
|
autofocus?: boolean;
|
||||||
onFocus?: EventHandlerNonNull;
|
onFocus?: EventHandler;
|
||||||
onBlur?: EventHandlerNonNull;
|
onBlur?: EventHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SinglePickerProps {
|
export interface SinglePickerProps {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import DownOutlined from '@ant-design/icons-vue/DownOutlined';
|
||||||
import VcInputNumber from '../vc-input-number/src';
|
import VcInputNumber from '../vc-input-number/src';
|
||||||
import { defaultConfigProvider } from '../config-provider';
|
import { defaultConfigProvider } from '../config-provider';
|
||||||
import { tuple, withInstall } from '../_util/type';
|
import { tuple, withInstall } from '../_util/type';
|
||||||
|
import type { EventHandler } from '../_util/EventInterface';
|
||||||
|
|
||||||
const inputNumberProps = {
|
const inputNumberProps = {
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
|
@ -28,7 +29,7 @@ const inputNumberProps = {
|
||||||
precision: PropTypes.number,
|
precision: PropTypes.number,
|
||||||
autofocus: PropTypes.looseBool,
|
autofocus: PropTypes.looseBool,
|
||||||
onPressEnter: {
|
onPressEnter: {
|
||||||
type: Function as PropType<EventHandlerNonNull>,
|
type: Function as PropType<EventHandler>,
|
||||||
},
|
},
|
||||||
onChange: Function as PropType<(num: number) => void>,
|
onChange: Function as PropType<(num: number) => void>,
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,6 +30,7 @@ import {
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import type { AutoSizeType } from '../input/ResizableTextArea';
|
import type { AutoSizeType } from '../input/ResizableTextArea';
|
||||||
import useConfigInject from '../_util/hooks/useConfigInject';
|
import useConfigInject from '../_util/hooks/useConfigInject';
|
||||||
|
import type { EventHandler } from '../_util/EventInterface';
|
||||||
|
|
||||||
export type BaseType = 'secondary' | 'success' | 'warning' | 'danger';
|
export type BaseType = 'secondary' | 'success' | 'warning' | 'danger';
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ export interface EllipsisConfig {
|
||||||
expandable?: boolean;
|
expandable?: boolean;
|
||||||
suffix?: string;
|
suffix?: string;
|
||||||
symbol?: string;
|
symbol?: string;
|
||||||
onExpand?: EventHandlerNonNull;
|
onExpand?: EventHandler;
|
||||||
onEllipsis?: (ellipsis: boolean) => void;
|
onEllipsis?: (ellipsis: boolean) => void;
|
||||||
tooltip?: boolean;
|
tooltip?: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import type {
|
||||||
} from './interface';
|
} from './interface';
|
||||||
import type { RawValueType, FlattenOptionsType } from './interface/generator';
|
import type { RawValueType, FlattenOptionsType } from './interface/generator';
|
||||||
import useMemo from '../_util/hooks/useMemo';
|
import useMemo from '../_util/hooks/useMemo';
|
||||||
|
import type { EventHandler } from '../_util/EventInterface';
|
||||||
export interface OptionListProps {
|
export interface OptionListProps {
|
||||||
prefixCls: string;
|
prefixCls: string;
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -37,10 +38,10 @@ export interface OptionListProps {
|
||||||
onToggleOpen: (open?: boolean) => void;
|
onToggleOpen: (open?: boolean) => void;
|
||||||
/** Tell Select that some value is now active to make accessibility work */
|
/** Tell Select that some value is now active to make accessibility work */
|
||||||
onActiveValue: OnActiveValue;
|
onActiveValue: OnActiveValue;
|
||||||
onScroll: EventHandlerNonNull;
|
onScroll: EventHandler;
|
||||||
|
|
||||||
/** Tell Select that mouse enter the popup to force re-render */
|
/** Tell Select that mouse enter the popup to force re-render */
|
||||||
onMouseenter?: EventHandlerNonNull;
|
onMouseenter?: EventHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
const OptionListProps = {
|
const OptionListProps = {
|
||||||
|
@ -90,7 +91,7 @@ const OptionList = defineComponent<OptionListProps, { state?: any }>({
|
||||||
// =========================== List ===========================
|
// =========================== List ===========================
|
||||||
const listRef = createRef();
|
const listRef = createRef();
|
||||||
|
|
||||||
const onListMouseDown: EventHandlerNonNull = event => {
|
const onListMouseDown: EventHandler = event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ 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';
|
||||||
|
|
||||||
interface InputProps {
|
interface InputProps {
|
||||||
prefixCls: string;
|
prefixCls: string;
|
||||||
|
@ -21,19 +22,43 @@ interface InputProps {
|
||||||
/** Pass accessibility props to input */
|
/** Pass accessibility props to input */
|
||||||
attrs: object;
|
attrs: object;
|
||||||
inputRef: RefObject;
|
inputRef: RefObject;
|
||||||
onKeydown: EventHandlerNonNull;
|
onKeydown: EventHandler;
|
||||||
onMousedown: EventHandlerNonNull;
|
onMousedown: EventHandler;
|
||||||
onChange: EventHandlerNonNull;
|
onChange: EventHandler;
|
||||||
onPaste: EventHandlerNonNull;
|
onPaste: EventHandler;
|
||||||
onCompositionstart: EventHandlerNonNull;
|
onCompositionstart: EventHandler;
|
||||||
onCompositionend: EventHandlerNonNull;
|
onCompositionend: EventHandler;
|
||||||
onFocus: EventHandlerNonNull;
|
onFocus: EventHandler;
|
||||||
onBlur: EventHandlerNonNull;
|
onBlur: EventHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Input = defineComponent<InputProps, { VCSelectContainerEvent: any; blurTimeout: any }>({
|
const Input = defineComponent({
|
||||||
name: 'Input',
|
name: 'Input',
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
|
props: {
|
||||||
|
inputRef: PropTypes.any,
|
||||||
|
prefixCls: PropTypes.string,
|
||||||
|
id: PropTypes.string,
|
||||||
|
inputElement: PropTypes.any,
|
||||||
|
disabled: PropTypes.looseBool,
|
||||||
|
autofocus: PropTypes.looseBool,
|
||||||
|
autocomplete: PropTypes.string,
|
||||||
|
editable: PropTypes.looseBool,
|
||||||
|
accessibilityIndex: PropTypes.number,
|
||||||
|
value: PropTypes.string,
|
||||||
|
open: PropTypes.looseBool,
|
||||||
|
tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||||
|
/** Pass accessibility props to input */
|
||||||
|
attrs: PropTypes.object,
|
||||||
|
onKeydown: PropTypes.func,
|
||||||
|
onMousedown: PropTypes.func,
|
||||||
|
onChange: PropTypes.func,
|
||||||
|
onPaste: PropTypes.func,
|
||||||
|
onCompositionstart: PropTypes.func,
|
||||||
|
onCompositionend: PropTypes.func,
|
||||||
|
onFocus: PropTypes.func,
|
||||||
|
onBlur: PropTypes.func,
|
||||||
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
if (process.env.NODE_ENV === 'test') {
|
if (process.env.NODE_ENV === 'test') {
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -47,7 +72,7 @@ const Input = defineComponent<InputProps, { VCSelectContainerEvent: any; blurTim
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
blurTimeout: null,
|
blurTimeout: null,
|
||||||
VCSelectContainerEvent: inject('VCSelectContainerEvent'),
|
VCSelectContainerEvent: inject('VCSelectContainerEvent') as any,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
|
@ -164,29 +189,29 @@ const Input = defineComponent<InputProps, { VCSelectContainerEvent: any; blurTim
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Input.props = {
|
// Input.props = {
|
||||||
inputRef: PropTypes.any,
|
// inputRef: PropTypes.any,
|
||||||
prefixCls: PropTypes.string,
|
// prefixCls: PropTypes.string,
|
||||||
id: PropTypes.string,
|
// id: PropTypes.string,
|
||||||
inputElement: PropTypes.any,
|
// inputElement: PropTypes.any,
|
||||||
disabled: PropTypes.looseBool,
|
// disabled: PropTypes.looseBool,
|
||||||
autofocus: PropTypes.looseBool,
|
// autofocus: PropTypes.looseBool,
|
||||||
autocomplete: PropTypes.string,
|
// autocomplete: PropTypes.string,
|
||||||
editable: PropTypes.looseBool,
|
// editable: PropTypes.looseBool,
|
||||||
accessibilityIndex: PropTypes.number,
|
// accessibilityIndex: PropTypes.number,
|
||||||
value: PropTypes.string,
|
// value: PropTypes.string,
|
||||||
open: PropTypes.looseBool,
|
// open: PropTypes.looseBool,
|
||||||
tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
// tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||||
/** Pass accessibility props to input */
|
// /** Pass accessibility props to input */
|
||||||
attrs: PropTypes.object,
|
// attrs: PropTypes.object,
|
||||||
onKeydown: PropTypes.func,
|
// onKeydown: PropTypes.func,
|
||||||
onMousedown: PropTypes.func,
|
// onMousedown: PropTypes.func,
|
||||||
onChange: PropTypes.func,
|
// onChange: PropTypes.func,
|
||||||
onPaste: PropTypes.func,
|
// onPaste: PropTypes.func,
|
||||||
onCompositionstart: PropTypes.func,
|
// onCompositionstart: PropTypes.func,
|
||||||
onCompositionend: PropTypes.func,
|
// onCompositionend: PropTypes.func,
|
||||||
onFocus: PropTypes.func,
|
// onFocus: PropTypes.func,
|
||||||
onBlur: PropTypes.func,
|
// onBlur: PropTypes.func,
|
||||||
};
|
// };
|
||||||
|
|
||||||
export default Input;
|
export default Input;
|
||||||
|
|
|
@ -19,6 +19,7 @@ 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';
|
||||||
import type { VueNode } from '../../_util/type';
|
import type { VueNode } from '../../_util/type';
|
||||||
|
import type { EventHandler } from '../../_util/EventInterface';
|
||||||
|
|
||||||
export interface SelectorProps {
|
export interface SelectorProps {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -57,7 +58,7 @@ export interface SelectorProps {
|
||||||
onSearch: (searchText: string, fromTyping: boolean, isCompositing: boolean) => boolean;
|
onSearch: (searchText: string, fromTyping: boolean, isCompositing: boolean) => boolean;
|
||||||
onSearchSubmit: (searchText: string) => void;
|
onSearchSubmit: (searchText: string) => void;
|
||||||
onSelect: (value: RawValueType, option: { selected: boolean }) => void;
|
onSelect: (value: RawValueType, option: { selected: boolean }) => void;
|
||||||
onInputKeyDown?: EventHandlerNonNull;
|
onInputKeyDown?: EventHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private get real dom for trigger align.
|
* @private get real dom for trigger align.
|
||||||
|
@ -106,7 +107,7 @@ const Selector = defineComponent<SelectorProps>({
|
||||||
onSearch: PropTypes.func,
|
onSearch: PropTypes.func,
|
||||||
onSearchSubmit: PropTypes.func,
|
onSearchSubmit: PropTypes.func,
|
||||||
onSelect: PropTypes.func,
|
onSelect: PropTypes.func,
|
||||||
onInputKeyDown: PropTypes.func,
|
onInputKeyDown: { type: Function as PropType<EventHandler> },
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private get real dom for trigger align.
|
* @private get real dom for trigger align.
|
||||||
|
|
|
@ -2,6 +2,7 @@ import type { RefObject } from '../../_util/createRef';
|
||||||
import type { VNodeChild } from 'vue';
|
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';
|
||||||
|
|
||||||
export interface InnerSelectorProps {
|
export interface InnerSelectorProps {
|
||||||
prefixCls: string;
|
prefixCls: string;
|
||||||
|
@ -18,10 +19,10 @@ export interface InnerSelectorProps {
|
||||||
accessibilityIndex: number;
|
accessibilityIndex: number;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
tabindex?: number | string;
|
tabindex?: number | string;
|
||||||
onInputKeyDown: EventHandlerNonNull;
|
onInputKeyDown: EventHandler;
|
||||||
onInputMouseDown: EventHandlerNonNull;
|
onInputMouseDown: EventHandler;
|
||||||
onInputChange: EventHandlerNonNull;
|
onInputChange: EventHandler;
|
||||||
onInputPaste: EventHandlerNonNull;
|
onInputPaste: EventHandler;
|
||||||
onInputCompositionStart: EventHandlerNonNull;
|
onInputCompositionStart: EventHandler;
|
||||||
onInputCompositionEnd: EventHandlerNonNull;
|
onInputCompositionEnd: EventHandler;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,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, DefineComponent, VNode, VNodeChild } from 'vue';
|
import type { CSSProperties, DefineComponent, PropType, VNode, VNodeChild } from 'vue';
|
||||||
import {
|
import {
|
||||||
computed,
|
computed,
|
||||||
defineComponent,
|
defineComponent,
|
||||||
|
@ -54,6 +54,7 @@ import PropTypes, { withUndefined } from '../_util/vue-types';
|
||||||
import initDefaultProps from '../_util/props-util/initDefaultProps';
|
import initDefaultProps from '../_util/props-util/initDefaultProps';
|
||||||
import warning from '../_util/warning';
|
import warning from '../_util/warning';
|
||||||
import isMobile from '../vc-util/isMobile';
|
import isMobile from '../vc-util/isMobile';
|
||||||
|
import type { EventHandler } from '../_util/EventInterface';
|
||||||
|
|
||||||
const DEFAULT_OMIT_PROPS = [
|
const DEFAULT_OMIT_PROPS = [
|
||||||
'children',
|
'children',
|
||||||
|
@ -148,7 +149,7 @@ export const BaseProps = () => ({
|
||||||
onDropdownVisibleChange: PropTypes.func,
|
onDropdownVisibleChange: PropTypes.func,
|
||||||
onSelect: PropTypes.func,
|
onSelect: PropTypes.func,
|
||||||
onDeselect: PropTypes.func,
|
onDeselect: PropTypes.func,
|
||||||
onInputKeyDown: PropTypes.func,
|
onInputKeyDown: { type: Function as PropType<EventHandler> },
|
||||||
onClick: PropTypes.func,
|
onClick: PropTypes.func,
|
||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
onBlur: PropTypes.func,
|
onBlur: PropTypes.func,
|
||||||
|
@ -244,20 +245,20 @@ export interface SelectProps<OptionsType extends object[], ValueType> {
|
||||||
tabindex?: number | string;
|
tabindex?: number | string;
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
onKeyup?: EventHandlerNonNull;
|
onKeyup?: EventHandler;
|
||||||
onKeydown?: EventHandlerNonNull;
|
onKeydown?: EventHandler;
|
||||||
onPopupScroll?: EventHandlerNonNull;
|
onPopupScroll?: EventHandler;
|
||||||
onDropdownVisibleChange?: (open: boolean) => void;
|
onDropdownVisibleChange?: (open: boolean) => void;
|
||||||
onSelect?: (value: SingleType<ValueType>, option: OptionsType[number]) => void;
|
onSelect?: (value: SingleType<ValueType>, option: OptionsType[number]) => void;
|
||||||
onDeselect?: (value: SingleType<ValueType>, option: OptionsType[number]) => void;
|
onDeselect?: (value: SingleType<ValueType>, option: OptionsType[number]) => void;
|
||||||
onInputKeyDown?: EventHandlerNonNull;
|
onInputKeyDown?: EventHandler;
|
||||||
onClick?: EventHandlerNonNull;
|
onClick?: EventHandler;
|
||||||
onChange?: (value: ValueType, option: OptionsType[number] | OptionsType) => void;
|
onChange?: (value: ValueType, option: OptionsType[number] | OptionsType) => void;
|
||||||
onBlur?: EventHandlerNonNull;
|
onBlur?: EventHandler;
|
||||||
onFocus?: EventHandlerNonNull;
|
onFocus?: EventHandler;
|
||||||
onMousedown?: EventHandlerNonNull;
|
onMousedown?: EventHandler;
|
||||||
onMouseenter?: EventHandlerNonNull;
|
onMouseenter?: EventHandler;
|
||||||
onMouseleave?: EventHandlerNonNull;
|
onMouseleave?: EventHandler;
|
||||||
|
|
||||||
// Motion
|
// Motion
|
||||||
choiceTransitionName?: string;
|
choiceTransitionName?: string;
|
||||||
|
@ -1326,7 +1327,7 @@ export default function generateSelector<
|
||||||
getTriggerDOMNode={() => selectorDomRef.current}
|
getTriggerDOMNode={() => selectorDomRef.current}
|
||||||
>
|
>
|
||||||
<Selector
|
<Selector
|
||||||
{...this.$props}
|
{...(this.$props as any)}
|
||||||
domRef={selectorDomRef}
|
domRef={selectorDomRef}
|
||||||
prefixCls={prefixCls}
|
prefixCls={prefixCls}
|
||||||
inputElement={customizeInputElement}
|
inputElement={customizeInputElement}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
"ant-design-vue/es/*": ["components/*"]
|
"ant-design-vue/es/*": ["components/*"]
|
||||||
},
|
},
|
||||||
"strictNullChecks": false,
|
"strictNullChecks": false,
|
||||||
"strict": true,
|
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
|
|
2
v2-doc
2
v2-doc
|
@ -1 +1 @@
|
||||||
Subproject commit e7db31900631a7da14f40b7f2ab0e3f266a26e00
|
Subproject commit 17abe8a32a993726902f52e153f5470c1ffba02a
|
Loading…
Reference in New Issue