2021-06-26 09:35:40 +08:00
|
|
|
import type { VNode } from 'vue';
|
2021-12-14 23:50:22 +08:00
|
|
|
import {
|
|
|
|
getCurrentInstance,
|
|
|
|
onBeforeUnmount,
|
|
|
|
onMounted,
|
|
|
|
watch,
|
|
|
|
ref,
|
|
|
|
defineComponent,
|
|
|
|
nextTick,
|
|
|
|
withDirectives,
|
|
|
|
} from 'vue';
|
2020-09-21 18:45:27 +08:00
|
|
|
import antInputDirective from '../_util/antInputDirective';
|
2020-08-31 16:53:19 +08:00
|
|
|
import classNames from '../_util/classNames';
|
2021-12-14 23:50:22 +08:00
|
|
|
import type { InputProps } from './inputProps';
|
2019-01-12 11:33:27 +08:00
|
|
|
import inputProps from './inputProps';
|
2021-12-14 23:50:22 +08:00
|
|
|
import type { Direction, SizeType } from '../config-provider';
|
2020-03-07 19:45:13 +08:00
|
|
|
import ClearableLabeledInput from './ClearableLabeledInput';
|
2021-09-25 16:51:32 +08:00
|
|
|
import { useInjectFormItemContext } from '../form/FormItemContext';
|
|
|
|
import omit from '../_util/omit';
|
2021-12-14 23:50:22 +08:00
|
|
|
import useConfigInject from '../_util/hooks/useConfigInject';
|
|
|
|
import type { ChangeEvent, FocusEventHandler } from '../_util/EventInterface';
|
2017-12-06 18:54:20 +08:00
|
|
|
|
2020-11-07 22:39:18 +08:00
|
|
|
export function fixControlledValue(value: string | number) {
|
2017-12-06 18:54:20 +08:00
|
|
|
if (typeof value === 'undefined' || value === null) {
|
2019-01-12 11:33:27 +08:00
|
|
|
return '';
|
2017-12-06 18:54:20 +08:00
|
|
|
}
|
2019-01-12 11:33:27 +08:00
|
|
|
return value;
|
2017-12-06 18:54:20 +08:00
|
|
|
}
|
|
|
|
|
2021-12-14 23:50:22 +08:00
|
|
|
export function resolveOnChange(
|
|
|
|
target: HTMLInputElement,
|
|
|
|
e: Event,
|
|
|
|
onChange: Function,
|
|
|
|
targetValue?: string,
|
|
|
|
) {
|
|
|
|
if (!onChange) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const event: any = e;
|
|
|
|
const originalInputValue = target.value;
|
|
|
|
|
|
|
|
if (e.type === 'click') {
|
|
|
|
Object.defineProperty(event, 'target', {
|
|
|
|
writable: true,
|
|
|
|
});
|
|
|
|
Object.defineProperty(event, 'currentTarget', {
|
|
|
|
writable: true,
|
|
|
|
});
|
|
|
|
// click clear icon
|
|
|
|
//event = Object.create(e);
|
|
|
|
event.target = target;
|
|
|
|
event.currentTarget = target;
|
|
|
|
// change target ref value cause e.target.value should be '' when clear input
|
|
|
|
target.value = '';
|
2020-03-07 19:45:13 +08:00
|
|
|
onChange(event);
|
2021-12-14 23:50:22 +08:00
|
|
|
// reset target ref value
|
|
|
|
target.value = originalInputValue;
|
|
|
|
return;
|
2020-03-07 19:45:13 +08:00
|
|
|
}
|
2021-12-14 23:50:22 +08:00
|
|
|
// Trigger by composition event, this means we need force change the input value
|
|
|
|
if (targetValue !== undefined) {
|
|
|
|
Object.defineProperty(event, 'target', {
|
|
|
|
writable: true,
|
|
|
|
});
|
|
|
|
Object.defineProperty(event, 'currentTarget', {
|
|
|
|
writable: true,
|
|
|
|
});
|
|
|
|
event.target = target;
|
|
|
|
event.currentTarget = target;
|
|
|
|
target.value = targetValue;
|
|
|
|
onChange(event);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
onChange(event);
|
2020-03-07 19:45:13 +08:00
|
|
|
}
|
|
|
|
|
2021-12-14 23:50:22 +08:00
|
|
|
export function getInputClassName(
|
|
|
|
prefixCls: string,
|
|
|
|
bordered: boolean,
|
|
|
|
size?: SizeType,
|
|
|
|
disabled?: boolean,
|
|
|
|
direction?: Direction,
|
|
|
|
) {
|
2020-03-07 19:45:13 +08:00
|
|
|
return classNames(prefixCls, {
|
|
|
|
[`${prefixCls}-sm`]: size === 'small',
|
|
|
|
[`${prefixCls}-lg`]: size === 'large',
|
|
|
|
[`${prefixCls}-disabled`]: disabled,
|
2021-12-14 23:50:22 +08:00
|
|
|
[`${prefixCls}-rtl`]: direction === 'rtl',
|
|
|
|
[`${prefixCls}-borderless`]: !bordered,
|
2020-03-07 19:45:13 +08:00
|
|
|
});
|
2019-04-07 17:19:18 +08:00
|
|
|
}
|
|
|
|
|
2021-12-14 23:50:22 +08:00
|
|
|
export interface InputFocusOptions extends FocusOptions {
|
|
|
|
cursor?: 'start' | 'end' | 'all';
|
|
|
|
}
|
|
|
|
export function triggerFocus(
|
|
|
|
element?: HTMLInputElement | HTMLTextAreaElement,
|
|
|
|
option?: InputFocusOptions,
|
|
|
|
) {
|
|
|
|
if (!element) return;
|
|
|
|
|
|
|
|
element.focus(option);
|
|
|
|
|
|
|
|
// Selection content
|
|
|
|
const { cursor } = option || {};
|
|
|
|
if (cursor) {
|
|
|
|
const len = element.value.length;
|
|
|
|
|
|
|
|
switch (cursor) {
|
|
|
|
case 'start':
|
|
|
|
element.setSelectionRange(0, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'end':
|
|
|
|
element.setSelectionRange(len, len);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
element.setSelectionRange(0, len);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-12 18:46:05 +08:00
|
|
|
export default defineComponent({
|
2018-04-08 21:17:20 +08:00
|
|
|
name: 'AInput',
|
2019-02-01 17:23:00 +08:00
|
|
|
inheritAttrs: false,
|
|
|
|
props: {
|
|
|
|
...inputProps,
|
|
|
|
},
|
2021-12-14 23:50:22 +08:00
|
|
|
setup(props, { slots, attrs, expose, emit }) {
|
|
|
|
const inputRef = ref();
|
|
|
|
const clearableInputRef = ref();
|
|
|
|
let removePasswordTimeout: any;
|
2021-09-25 16:51:32 +08:00
|
|
|
const formItemContext = useInjectFormItemContext();
|
2021-12-14 23:50:22 +08:00
|
|
|
const { direction, prefixCls, size, autocomplete } = useConfigInject('input', props);
|
2021-12-15 20:48:24 +08:00
|
|
|
const stateValue = ref(props.value === undefined ? props.defaultValue : props.value);
|
2021-12-14 23:50:22 +08:00
|
|
|
const focused = ref(false);
|
|
|
|
|
|
|
|
watch(
|
|
|
|
() => props.value,
|
|
|
|
() => {
|
2021-12-15 20:48:24 +08:00
|
|
|
if (props.value !== undefined) {
|
|
|
|
stateValue.value = props.value;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
);
|
|
|
|
watch(
|
|
|
|
() => props.disabled,
|
|
|
|
() => {
|
|
|
|
if (props.value !== undefined) {
|
2021-12-14 23:50:22 +08:00
|
|
|
stateValue.value = props.value;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
const clearPasswordValueAttribute = () => {
|
|
|
|
// https://github.com/ant-design/ant-design/issues/20541
|
|
|
|
removePasswordTimeout = setTimeout(() => {
|
|
|
|
if (
|
|
|
|
inputRef.value?.getAttribute('type') === 'password' &&
|
|
|
|
inputRef.value.hasAttribute('value')
|
|
|
|
) {
|
|
|
|
inputRef.value.removeAttribute('value');
|
|
|
|
}
|
|
|
|
});
|
2020-06-27 14:02:30 +08:00
|
|
|
};
|
2021-12-14 23:50:22 +08:00
|
|
|
|
|
|
|
const focus = (option?: InputFocusOptions) => {
|
|
|
|
triggerFocus(inputRef.value, option);
|
2019-01-12 11:33:27 +08:00
|
|
|
};
|
2021-12-14 23:50:22 +08:00
|
|
|
|
|
|
|
const blur = () => {
|
|
|
|
inputRef.value?.blur();
|
|
|
|
};
|
|
|
|
|
|
|
|
const setSelectionRange = (
|
|
|
|
start: number,
|
|
|
|
end: number,
|
|
|
|
direction?: 'forward' | 'backward' | 'none',
|
|
|
|
) => {
|
|
|
|
inputRef.value?.setSelectionRange(start, end, direction);
|
|
|
|
};
|
|
|
|
|
|
|
|
const select = () => {
|
|
|
|
inputRef.value?.select();
|
|
|
|
};
|
|
|
|
|
|
|
|
expose({
|
|
|
|
focus,
|
|
|
|
blur,
|
2021-12-15 20:48:24 +08:00
|
|
|
input: inputRef,
|
2021-12-14 23:50:22 +08:00
|
|
|
stateValue,
|
|
|
|
setSelectionRange,
|
|
|
|
select,
|
2019-01-12 11:33:27 +08:00
|
|
|
});
|
2021-12-14 23:50:22 +08:00
|
|
|
|
|
|
|
const onFocus: FocusEventHandler = e => {
|
|
|
|
const { onFocus } = props;
|
|
|
|
focused.value = true;
|
|
|
|
onFocus?.(e);
|
|
|
|
nextTick(() => {
|
|
|
|
clearPasswordValueAttribute();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const onBlur: FocusEventHandler = e => {
|
|
|
|
const { onBlur } = props;
|
|
|
|
focused.value = false;
|
|
|
|
onBlur?.(e);
|
|
|
|
formItemContext.onFieldBlur();
|
|
|
|
nextTick(() => {
|
|
|
|
clearPasswordValueAttribute();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const triggerChange = (e: Event) => {
|
|
|
|
emit('update:value', (e.target as HTMLInputElement).value);
|
|
|
|
emit('change', e);
|
|
|
|
emit('input', e);
|
|
|
|
formItemContext.onFieldChange();
|
|
|
|
};
|
|
|
|
const instance = getCurrentInstance();
|
|
|
|
const setValue = (value: string | number, callback?: Function) => {
|
|
|
|
if (stateValue.value === value) {
|
2019-04-07 17:19:18 +08:00
|
|
|
return;
|
|
|
|
}
|
2021-12-15 20:48:24 +08:00
|
|
|
if (props.value === undefined) {
|
2021-12-14 23:50:22 +08:00
|
|
|
stateValue.value = value;
|
2019-04-07 17:19:18 +08:00
|
|
|
} else {
|
2021-12-14 23:50:22 +08:00
|
|
|
instance.update();
|
2019-04-07 17:19:18 +08:00
|
|
|
}
|
2020-10-28 15:31:45 +08:00
|
|
|
nextTick(() => {
|
2020-07-30 18:41:38 +08:00
|
|
|
callback && callback();
|
|
|
|
});
|
2021-12-14 23:50:22 +08:00
|
|
|
};
|
|
|
|
const handleReset = (e: MouseEvent) => {
|
|
|
|
resolveOnChange(inputRef.value, e, triggerChange);
|
|
|
|
setValue('', () => {
|
|
|
|
focus();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const handleChange = (e: ChangeEvent) => {
|
2021-12-15 20:48:24 +08:00
|
|
|
const { value, composing } = e.target as any;
|
2021-12-14 23:50:22 +08:00
|
|
|
// https://github.com/vueComponent/ant-design-vue/issues/2203
|
2021-12-15 20:48:24 +08:00
|
|
|
if ((((e as any).isComposing || composing) && props.lazy) || stateValue.value === value)
|
|
|
|
return;
|
2021-12-14 23:50:22 +08:00
|
|
|
const newVal = e.target.value;
|
|
|
|
resolveOnChange(inputRef.value, e, triggerChange);
|
|
|
|
setValue(newVal, () => {
|
|
|
|
clearPasswordValueAttribute();
|
2019-10-17 19:26:58 +08:00
|
|
|
});
|
2021-12-14 23:50:22 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const handleKeyDown = (e: KeyboardEvent) => {
|
|
|
|
if (e.keyCode === 13) {
|
|
|
|
emit('pressEnter', e);
|
|
|
|
}
|
|
|
|
emit('keydown', e);
|
|
|
|
};
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
if (process.env.NODE_ENV === 'test') {
|
|
|
|
if (props.autofocus) {
|
|
|
|
focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
clearPasswordValueAttribute();
|
|
|
|
});
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
clearTimeout(removePasswordTimeout);
|
|
|
|
});
|
|
|
|
|
|
|
|
const renderInput = () => {
|
|
|
|
const {
|
|
|
|
addonBefore = slots.addonBefore,
|
|
|
|
addonAfter = slots.addonAfter,
|
|
|
|
disabled,
|
|
|
|
bordered = true,
|
|
|
|
valueModifiers = {},
|
2021-12-15 20:48:24 +08:00
|
|
|
htmlSize,
|
2021-12-14 23:50:22 +08:00
|
|
|
} = props;
|
|
|
|
const otherProps = omit(props as InputProps & { inputType: any; placeholder: string }, [
|
2017-12-07 12:31:12 +08:00
|
|
|
'prefixCls',
|
2020-07-30 18:41:38 +08:00
|
|
|
'onPressEnter',
|
2018-04-07 14:29:59 +08:00
|
|
|
'addonBefore',
|
|
|
|
'addonAfter',
|
|
|
|
'prefix',
|
|
|
|
'suffix',
|
2019-09-11 18:11:48 +08:00
|
|
|
'allowClear',
|
2021-12-14 23:50:22 +08:00
|
|
|
// Input elements must be either controlled or uncontrolled,
|
|
|
|
// specify either the value prop, or the defaultValue prop, but not both.
|
2019-01-03 20:51:56 +08:00
|
|
|
'defaultValue',
|
2020-03-07 19:45:13 +08:00
|
|
|
'size',
|
2021-12-14 23:50:22 +08:00
|
|
|
'inputType',
|
|
|
|
'bordered',
|
2021-12-15 20:48:24 +08:00
|
|
|
'htmlSize',
|
2019-01-12 11:33:27 +08:00
|
|
|
]);
|
2021-12-14 23:50:22 +08:00
|
|
|
const inputProps = {
|
2020-06-27 14:02:30 +08:00
|
|
|
...otherProps,
|
2021-12-15 20:48:24 +08:00
|
|
|
...attrs,
|
2021-12-14 23:50:22 +08:00
|
|
|
autocomplete: autocomplete.value,
|
|
|
|
onChange: handleChange,
|
|
|
|
onInput: handleChange,
|
|
|
|
onFocus,
|
|
|
|
onBlur,
|
2020-06-27 14:02:30 +08:00
|
|
|
onKeydown: handleKeyDown,
|
2021-12-14 23:50:22 +08:00
|
|
|
class: classNames(
|
|
|
|
getInputClassName(prefixCls.value, bordered, size.value, disabled, direction.value),
|
|
|
|
{
|
|
|
|
[attrs.class as string]: attrs.class && !addonBefore && !addonAfter,
|
|
|
|
},
|
|
|
|
),
|
|
|
|
ref: inputRef,
|
2019-09-11 18:11:48 +08:00
|
|
|
key: 'ant-input',
|
2021-12-15 20:48:24 +08:00
|
|
|
size: htmlSize,
|
2019-01-12 11:33:27 +08:00
|
|
|
};
|
2021-12-10 16:29:04 +08:00
|
|
|
if (valueModifiers.lazy) {
|
|
|
|
delete inputProps.onInput;
|
|
|
|
}
|
2020-07-17 17:36:58 +08:00
|
|
|
if (!inputProps.autofocus) {
|
|
|
|
delete inputProps.autofocus;
|
2020-07-07 13:57:11 +08:00
|
|
|
}
|
2020-10-19 16:43:10 +08:00
|
|
|
const inputNode = <input {...inputProps} />;
|
2020-10-16 14:24:14 +08:00
|
|
|
return withDirectives(inputNode as VNode, [[antInputDirective]]);
|
2020-03-07 19:45:13 +08:00
|
|
|
};
|
2021-09-25 16:51:32 +08:00
|
|
|
|
2021-12-14 23:50:22 +08:00
|
|
|
return () => {
|
|
|
|
const inputProps: any = {
|
|
|
|
...attrs,
|
|
|
|
...props,
|
|
|
|
prefixCls: prefixCls.value,
|
|
|
|
inputType: 'input',
|
|
|
|
value: fixControlledValue(stateValue.value),
|
|
|
|
handleReset,
|
2021-12-15 20:48:24 +08:00
|
|
|
focused: focused.value && props.disabled,
|
2021-12-14 23:50:22 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ClearableLabeledInput
|
|
|
|
{...omit(inputProps, ['element', 'valueModifiers'])}
|
|
|
|
ref={clearableInputRef}
|
|
|
|
v-slots={{ ...slots, element: renderInput }}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
2017-12-06 18:54:20 +08:00
|
|
|
},
|
2021-12-14 23:50:22 +08:00
|
|
|
|
|
|
|
// methods: {
|
|
|
|
// handleInputFocus(e: Event) {
|
|
|
|
// this.isFocused = true;
|
|
|
|
// this.onFocus && this.onFocus(e);
|
|
|
|
// },
|
|
|
|
|
|
|
|
// handleInputBlur(e: Event) {
|
|
|
|
// this.isFocused = false;
|
|
|
|
// this.onBlur && this.onBlur(e);
|
|
|
|
// this.formItemContext.onFieldBlur();
|
|
|
|
// },
|
|
|
|
|
|
|
|
// focus() {
|
|
|
|
// this.input.focus();
|
|
|
|
// },
|
|
|
|
|
|
|
|
// blur() {
|
|
|
|
// this.input.blur();
|
|
|
|
// },
|
|
|
|
// select() {
|
|
|
|
// this.input.select();
|
|
|
|
// },
|
|
|
|
|
|
|
|
// saveClearableInput(input: HTMLInputElement) {
|
|
|
|
// this.clearableInput = input;
|
|
|
|
// },
|
|
|
|
|
|
|
|
// saveInput(input: HTMLInputElement) {
|
|
|
|
// this.input = input;
|
|
|
|
// },
|
|
|
|
|
|
|
|
// setValue(value: string | number, callback?: Function) {
|
|
|
|
// if (this.stateValue === value) {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// if (!hasProp(this, 'value')) {
|
|
|
|
// this.stateValue = value;
|
|
|
|
// } else {
|
|
|
|
// (this as any).$forceUpdate();
|
|
|
|
// }
|
|
|
|
// nextTick(() => {
|
|
|
|
// callback && callback();
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// triggerChange(e: Event) {
|
|
|
|
// this.$emit('update:value', (e.target as HTMLInputElement).value);
|
|
|
|
// this.$emit('change', e);
|
|
|
|
// this.$emit('input', e);
|
|
|
|
// this.formItemContext.onFieldChange();
|
|
|
|
// },
|
|
|
|
// handleReset(e: Event) {
|
|
|
|
// this.setValue('', () => {
|
|
|
|
// this.focus();
|
|
|
|
// });
|
|
|
|
// resolveOnChange(this.input, e, this.triggerChange);
|
|
|
|
// },
|
|
|
|
// renderInput(prefixCls: string, { addonBefore, addonAfter }) {
|
|
|
|
// const otherProps = omit(this.$props, [
|
|
|
|
// 'prefixCls',
|
|
|
|
// 'onPressEnter',
|
|
|
|
// 'addonBefore',
|
|
|
|
// 'addonAfter',
|
|
|
|
// 'prefix',
|
|
|
|
// 'suffix',
|
|
|
|
// 'allowClear',
|
|
|
|
// 'defaultValue',
|
|
|
|
// 'lazy',
|
|
|
|
// 'size',
|
|
|
|
// 'inputPrefixCls',
|
|
|
|
// 'loading',
|
|
|
|
// ]);
|
|
|
|
// const {
|
|
|
|
// handleKeyDown,
|
|
|
|
// handleChange,
|
|
|
|
// handleInputFocus,
|
|
|
|
// handleInputBlur,
|
|
|
|
// size,
|
|
|
|
// disabled,
|
|
|
|
// valueModifiers = {},
|
|
|
|
// $attrs,
|
|
|
|
// } = this;
|
|
|
|
// const inputProps: any = {
|
|
|
|
// ...otherProps,
|
|
|
|
// ...$attrs,
|
|
|
|
// id: otherProps.id ?? this.formItemContext.id.value,
|
|
|
|
// onKeydown: handleKeyDown,
|
|
|
|
// class: classNames(getInputClassName(prefixCls, size, disabled), {
|
|
|
|
// [$attrs.class as string]: $attrs.class && !addonBefore && !addonAfter,
|
|
|
|
// }),
|
|
|
|
// ref: this.saveInput,
|
|
|
|
// key: 'ant-input',
|
|
|
|
// onInput: handleChange,
|
|
|
|
// onChange: handleChange,
|
|
|
|
// onFocus: handleInputFocus,
|
|
|
|
// onBlur: handleInputBlur,
|
|
|
|
// };
|
|
|
|
// if (valueModifiers.lazy) {
|
|
|
|
// delete inputProps.onInput;
|
|
|
|
// }
|
|
|
|
// if (!inputProps.autofocus) {
|
|
|
|
// delete inputProps.autofocus;
|
|
|
|
// }
|
|
|
|
// const inputNode = <input {...inputProps} />;
|
|
|
|
// return withDirectives(inputNode as VNode, [[antInputDirective]]);
|
|
|
|
// },
|
|
|
|
// clearPasswordValueAttribute() {
|
|
|
|
// // https://github.com/ant-design/ant-design/issues/20541
|
|
|
|
// this.removePasswordTimeout = setTimeout(() => {
|
|
|
|
// if (
|
|
|
|
// this.input &&
|
|
|
|
// this.input.getAttribute &&
|
|
|
|
// this.input.getAttribute('type') === 'password' &&
|
|
|
|
// this.input.hasAttribute('value')
|
|
|
|
// ) {
|
|
|
|
// this.input.removeAttribute('value');
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// handleChange(e: Event) {
|
|
|
|
// const { value, composing, isComposing } = e.target as any;
|
|
|
|
// // https://github.com/vueComponent/ant-design-vue/issues/2203
|
|
|
|
// if (((isComposing || composing) && this.lazy) || this.stateValue === value) return;
|
|
|
|
// this.setValue(value, this.clearPasswordValueAttribute);
|
|
|
|
// resolveOnChange(this.input, e, this.triggerChange);
|
|
|
|
// },
|
|
|
|
// handleKeyDown(e: KeyboardEvent) {
|
|
|
|
// if (e.keyCode === 13) {
|
|
|
|
// this.$emit('pressEnter', e);
|
|
|
|
// }
|
|
|
|
// this.$emit('keydown', e);
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// render() {
|
|
|
|
// const { prefixCls: customizePrefixCls } = this.$props;
|
|
|
|
// const { stateValue, isFocused } = this.$data;
|
|
|
|
// const getPrefixCls = this.configProvider.getPrefixCls;
|
|
|
|
// const prefixCls = getPrefixCls('input', customizePrefixCls);
|
|
|
|
// const addonAfter = getComponent(this, 'addonAfter');
|
|
|
|
// const addonBefore = getComponent(this, 'addonBefore');
|
|
|
|
// const suffix = getComponent(this, 'suffix');
|
|
|
|
// const prefix = getComponent(this, 'prefix');
|
|
|
|
// const props: any = {
|
|
|
|
// ...this.$attrs,
|
|
|
|
// ...getOptionProps(this),
|
|
|
|
// prefixCls,
|
|
|
|
// inputType: 'input',
|
|
|
|
// value: fixControlledValue(stateValue),
|
|
|
|
// element: this.renderInput(prefixCls, { addonAfter, addonBefore }),
|
|
|
|
// handleReset: this.handleReset,
|
|
|
|
// addonAfter,
|
|
|
|
// addonBefore,
|
|
|
|
// suffix,
|
|
|
|
// prefix,
|
|
|
|
// isFocused,
|
|
|
|
// };
|
|
|
|
|
|
|
|
// return <ClearableLabeledInput {...props} ref={this.saveClearableInput} />;
|
|
|
|
// },
|
2020-10-12 18:46:05 +08:00
|
|
|
});
|