import type { ExtractPropTypes, PropType } from 'vue'; import PropTypes from '../_util/vue-types'; import type { SizeType } from '../config-provider'; import omit from '../_util/omit'; import type { LiteralUnion, VueNode } from '../_util/type'; export const inputDefaultValue = Symbol() as unknown as string; const inputProps = { id: PropTypes.string, prefixCls: PropTypes.string, inputPrefixCls: PropTypes.string, defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), value: { type: [String, Number, Symbol] as PropType, default: undefined, }, placeholder: { type: [String, Number] as PropType, }, autocomplete: String, type: { type: String as PropType< LiteralUnion< | 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week', string > >, default: 'text', }, name: PropTypes.string, size: { type: String as PropType }, disabled: PropTypes.looseBool, readonly: PropTypes.looseBool, addonBefore: PropTypes.any, addonAfter: PropTypes.any, prefix: PropTypes.any, suffix: PropTypes.any, autofocus: PropTypes.looseBool, allowClear: PropTypes.looseBool, lazy: PropTypes.looseBool.def(true), maxlength: PropTypes.number, loading: PropTypes.looseBool, bordered: PropTypes.looseBool, showCount: { type: [Boolean, Object] as PropType }, htmlSize: Number, onPressEnter: PropTypes.func, onKeydown: PropTypes.func, onKeyup: PropTypes.func, onFocus: PropTypes.func, onBlur: PropTypes.func, onChange: PropTypes.func, onInput: PropTypes.func, 'onUpdate:value': PropTypes.func, valueModifiers: Object, hidden: Boolean, }; export default inputProps; export type InputProps = Partial>; export interface AutoSizeType { minRows?: number; maxRows?: number; } export interface ShowCountProps { formatter: (args: { count: number; maxlength?: number }) => VueNode; } const textAreaProps = { ...omit(inputProps, ['prefix', 'addonBefore', 'addonAfter', 'suffix']), rows: Number, autosize: { type: [Boolean, Object] as PropType, default: undefined }, autoSize: { type: [Boolean, Object] as PropType, default: undefined }, onResize: { type: Function as PropType<(size: { width: number; height: number }) => void> }, onCompositionstart: PropTypes.func, onCompositionend: PropTypes.func, valueModifiers: Object, }; export { textAreaProps }; export type TextAreaProps = Partial>;