Merge remote-tracking branch 'origin/next' into v2.3
commit
c1c7c8e5d4
|
@ -6,3 +6,5 @@ export type ChangeEvent = Event & {
|
|||
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 warning from '../_util/warning';
|
||||
import type { RadioChangeEvent } from '../radio/interface';
|
||||
import type { EventHandler } from '../_util/EventInterface';
|
||||
function noop() {}
|
||||
|
||||
export default defineComponent({
|
||||
|
@ -127,8 +128,8 @@ export default defineComponent({
|
|||
<label
|
||||
class={classString}
|
||||
style={style}
|
||||
onMouseenter={onMouseenter as EventHandlerNonNull}
|
||||
onMouseleave={onMouseleave as EventHandlerNonNull}
|
||||
onMouseenter={onMouseenter as EventHandler}
|
||||
onMouseleave={onMouseleave as EventHandler}
|
||||
>
|
||||
<VcCheckbox {...checkboxProps} class={checkboxClass} ref="vcCheckbox" />
|
||||
{children.length ? <span>{children}</span> : null}
|
||||
|
|
|
@ -8,6 +8,7 @@ import DownOutlined from '@ant-design/icons-vue/DownOutlined';
|
|||
import VcInputNumber from '../vc-input-number/src';
|
||||
import { defaultConfigProvider } from '../config-provider';
|
||||
import { tuple, withInstall } from '../_util/type';
|
||||
import type { EventHandler } from '../_util/EventInterface';
|
||||
|
||||
const inputNumberProps = {
|
||||
prefixCls: PropTypes.string,
|
||||
|
@ -28,7 +29,7 @@ const inputNumberProps = {
|
|||
precision: PropTypes.number,
|
||||
autofocus: PropTypes.looseBool,
|
||||
onPressEnter: {
|
||||
type: Function as PropType<EventHandlerNonNull>,
|
||||
type: Function as PropType<EventHandler>,
|
||||
},
|
||||
onChange: Function as PropType<(num: number) => void>,
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@ import {
|
|||
} from 'vue';
|
||||
import type { AutoSizeType } from '../input/ResizableTextArea';
|
||||
import useConfigInject from '../_util/hooks/useConfigInject';
|
||||
import type { EventHandler } from '../_util/EventInterface';
|
||||
|
||||
export type BaseType = 'secondary' | 'success' | 'warning' | 'danger';
|
||||
|
||||
|
@ -58,7 +59,7 @@ export interface EllipsisConfig {
|
|||
expandable?: boolean;
|
||||
suffix?: string;
|
||||
symbol?: string;
|
||||
onExpand?: EventHandlerNonNull;
|
||||
onExpand?: EventHandler;
|
||||
onEllipsis?: (ellipsis: boolean) => void;
|
||||
tooltip?: boolean;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ export const imageProps = {
|
|||
PropTypes.shape({
|
||||
visible: PropTypes.bool,
|
||||
onVisibleChange: PropTypes.func,
|
||||
getContainer: PropTypes.oneOf([PropTypes.func, PropTypes.bool]),
|
||||
getContainer: PropTypes.oneOfType([PropTypes.func, PropTypes.looseBool, PropTypes.string]),
|
||||
}).loose,
|
||||
]).def(true),
|
||||
};
|
||||
|
|
|
@ -22,6 +22,8 @@ export interface RefOptionListProps {
|
|||
onKeyup: (e?: KeyboardEvent) => void;
|
||||
scrollTo?: (index: number) => void;
|
||||
}
|
||||
|
||||
import type { EventHandler } from '../_util/EventInterface';
|
||||
export interface OptionListProps<OptionType extends object> {
|
||||
prefixCls: string;
|
||||
id: string;
|
||||
|
@ -43,10 +45,10 @@ export interface OptionListProps<OptionType extends object> {
|
|||
onToggleOpen: (open?: boolean) => void;
|
||||
/** Tell Select that some value is now active to make accessibility work */
|
||||
onActiveValue: OnActiveValue;
|
||||
onScroll: EventHandlerNonNull;
|
||||
onScroll: EventHandler;
|
||||
|
||||
/** Tell Select that mouse enter the popup to force re-render */
|
||||
onMouseenter?: EventHandlerNonNull;
|
||||
onMouseenter?: EventHandler;
|
||||
}
|
||||
|
||||
const OptionListProps = {
|
||||
|
@ -96,7 +98,7 @@ const OptionList = defineComponent<OptionListProps<SelectOptionsType[number]>, {
|
|||
// =========================== List ===========================
|
||||
const listRef = createRef();
|
||||
|
||||
const onListMouseDown: EventHandlerNonNull = event => {
|
||||
const onListMouseDown: EventHandler = event => {
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import PropTypes from '../../_util/vue-types';
|
|||
import type { RefObject } from '../../_util/createRef';
|
||||
import antInput from '../../_util/antInputDirective';
|
||||
import classNames from '../../_util/classNames';
|
||||
import type { EventHandler } from '../../_util/EventInterface';
|
||||
|
||||
interface InputProps {
|
||||
prefixCls: string;
|
||||
|
@ -21,19 +22,43 @@ interface InputProps {
|
|||
/** Pass accessibility props to input */
|
||||
attrs: object;
|
||||
inputRef: RefObject;
|
||||
onKeydown: EventHandlerNonNull;
|
||||
onMousedown: EventHandlerNonNull;
|
||||
onChange: EventHandlerNonNull;
|
||||
onPaste: EventHandlerNonNull;
|
||||
onCompositionstart: EventHandlerNonNull;
|
||||
onCompositionend: EventHandlerNonNull;
|
||||
onFocus: EventHandlerNonNull;
|
||||
onBlur: EventHandlerNonNull;
|
||||
onKeydown: EventHandler;
|
||||
onMousedown: EventHandler;
|
||||
onChange: EventHandler;
|
||||
onPaste: EventHandler;
|
||||
onCompositionstart: EventHandler;
|
||||
onCompositionend: EventHandler;
|
||||
onFocus: EventHandler;
|
||||
onBlur: EventHandler;
|
||||
}
|
||||
|
||||
const Input = defineComponent<InputProps, { VCSelectContainerEvent: any; blurTimeout: any }>({
|
||||
const Input = defineComponent({
|
||||
name: 'Input',
|
||||
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) {
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
onMounted(() => {
|
||||
|
@ -47,7 +72,7 @@ const Input = defineComponent<InputProps, { VCSelectContainerEvent: any; blurTim
|
|||
}
|
||||
return {
|
||||
blurTimeout: null,
|
||||
VCSelectContainerEvent: inject('VCSelectContainerEvent'),
|
||||
VCSelectContainerEvent: inject('VCSelectContainerEvent') as any,
|
||||
};
|
||||
},
|
||||
render() {
|
||||
|
@ -164,29 +189,29 @@ const Input = defineComponent<InputProps, { VCSelectContainerEvent: any; blurTim
|
|||
},
|
||||
});
|
||||
|
||||
Input.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,
|
||||
};
|
||||
// Input.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,
|
||||
// };
|
||||
|
||||
export default Input;
|
||||
|
|
|
@ -19,6 +19,7 @@ import { defineComponent } from 'vue';
|
|||
import createRef from '../../_util/createRef';
|
||||
import PropTypes from '../../_util/vue-types';
|
||||
import type { VueNode } from '../../_util/type';
|
||||
import type { EventHandler } from '../../_util/EventInterface';
|
||||
|
||||
export interface SelectorProps {
|
||||
id: string;
|
||||
|
@ -106,7 +107,7 @@ const Selector = defineComponent<SelectorProps>({
|
|||
onSearch: PropTypes.func,
|
||||
onSearchSubmit: PropTypes.func,
|
||||
onSelect: PropTypes.func,
|
||||
onInputKeyDown: PropTypes.func,
|
||||
onInputKeyDown: { type: Function as PropType<EventHandler> },
|
||||
|
||||
/**
|
||||
* @private get real dom for trigger align.
|
||||
|
|
|
@ -2,6 +2,7 @@ import type { RefObject } from '../../_util/createRef';
|
|||
import type { VNodeChild } from 'vue';
|
||||
import type { Mode } from '../interface';
|
||||
import type { LabelValueType } from '../interface/generator';
|
||||
import type { EventHandler } from '../../_util/EventInterface';
|
||||
|
||||
export interface InnerSelectorProps {
|
||||
prefixCls: string;
|
||||
|
@ -18,10 +19,10 @@ export interface InnerSelectorProps {
|
|||
accessibilityIndex: number;
|
||||
open: boolean;
|
||||
tabindex?: number | string;
|
||||
onInputKeyDown: EventHandlerNonNull;
|
||||
onInputMouseDown: EventHandlerNonNull;
|
||||
onInputChange: EventHandlerNonNull;
|
||||
onInputPaste: EventHandlerNonNull;
|
||||
onInputCompositionStart: EventHandlerNonNull;
|
||||
onInputCompositionEnd: EventHandlerNonNull;
|
||||
onInputKeyDown: EventHandler;
|
||||
onInputMouseDown: EventHandler;
|
||||
onInputChange: EventHandler;
|
||||
onInputPaste: EventHandler;
|
||||
onInputCompositionStart: EventHandler;
|
||||
onInputCompositionEnd: EventHandler;
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@
|
|||
"through2": "^3.0.0",
|
||||
"ts-jest": "^26.4.1",
|
||||
"ts-loader": "^9.1.0",
|
||||
"typescript": "^4.2.0",
|
||||
"typescript": "~4.3.5",
|
||||
"umi-mock-middleware": "^1.0.0",
|
||||
"umi-request": "^1.3.5",
|
||||
"url-loader": "^3.0.0",
|
||||
|
|
2
v2-doc
2
v2-doc
|
@ -1 +1 @@
|
|||
Subproject commit 36b2776cbf91e0db3b14d40d14879417490c56eb
|
||||
Subproject commit 17abe8a32a993726902f52e153f5470c1ffba02a
|
Loading…
Reference in New Issue