add all frontend files

This commit is contained in:
2026-01-17 15:16:36 -05:00
parent ff16ae7858
commit e40287e4aa
25704 changed files with 1935289 additions and 0 deletions

8
node_modules/rc-input/es/BaseInput.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import React from 'react';
import type { BaseInputProps } from './interface';
export interface HolderRef {
/** Provider holder ref. Will return `null` if not wrap anything */
nativeElement: HTMLElement | null;
}
declare const BaseInput: React.ForwardRefExoticComponent<BaseInputProps & React.RefAttributes<HolderRef>>;
export default BaseInput;

130
node_modules/rc-input/es/BaseInput.js generated vendored Normal file
View File

@@ -0,0 +1,130 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _extends from "@babel/runtime/helpers/esm/extends";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _typeof from "@babel/runtime/helpers/esm/typeof";
import clsx from 'classnames';
import React, { cloneElement, useRef } from 'react';
import { hasAddon, hasPrefixSuffix } from "./utils/commonUtils";
var BaseInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
var _props, _props2, _props3;
var inputEl = props.inputElement,
children = props.children,
prefixCls = props.prefixCls,
prefix = props.prefix,
suffix = props.suffix,
addonBefore = props.addonBefore,
addonAfter = props.addonAfter,
className = props.className,
style = props.style,
disabled = props.disabled,
readOnly = props.readOnly,
focused = props.focused,
triggerFocus = props.triggerFocus,
allowClear = props.allowClear,
value = props.value,
handleReset = props.handleReset,
hidden = props.hidden,
classes = props.classes,
classNames = props.classNames,
dataAttrs = props.dataAttrs,
styles = props.styles,
components = props.components,
onClear = props.onClear;
var inputElement = children !== null && children !== void 0 ? children : inputEl;
var AffixWrapperComponent = (components === null || components === void 0 ? void 0 : components.affixWrapper) || 'span';
var GroupWrapperComponent = (components === null || components === void 0 ? void 0 : components.groupWrapper) || 'span';
var WrapperComponent = (components === null || components === void 0 ? void 0 : components.wrapper) || 'span';
var GroupAddonComponent = (components === null || components === void 0 ? void 0 : components.groupAddon) || 'span';
var containerRef = useRef(null);
var onInputClick = function onInputClick(e) {
var _containerRef$current;
if ((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 && _containerRef$current.contains(e.target)) {
triggerFocus === null || triggerFocus === void 0 || triggerFocus();
}
};
var hasAffix = hasPrefixSuffix(props);
var element = /*#__PURE__*/cloneElement(inputElement, {
value: value,
className: clsx((_props = inputElement.props) === null || _props === void 0 ? void 0 : _props.className, !hasAffix && (classNames === null || classNames === void 0 ? void 0 : classNames.variant)) || null
});
// ======================== Ref ======================== //
var groupRef = useRef(null);
React.useImperativeHandle(ref, function () {
return {
nativeElement: groupRef.current || containerRef.current
};
});
// ================== Prefix & Suffix ================== //
if (hasAffix) {
// ================== Clear Icon ================== //
var clearIcon = null;
if (allowClear) {
var needClear = !disabled && !readOnly && value;
var clearIconCls = "".concat(prefixCls, "-clear-icon");
var iconNode = _typeof(allowClear) === 'object' && allowClear !== null && allowClear !== void 0 && allowClear.clearIcon ? allowClear.clearIcon : '✖';
clearIcon = /*#__PURE__*/React.createElement("button", {
type: "button",
tabIndex: -1,
onClick: function onClick(event) {
handleReset === null || handleReset === void 0 || handleReset(event);
onClear === null || onClear === void 0 || onClear();
}
// Do not trigger onBlur when clear input
// https://github.com/ant-design/ant-design/issues/31200
,
onMouseDown: function onMouseDown(e) {
return e.preventDefault();
},
className: clsx(clearIconCls, _defineProperty(_defineProperty({}, "".concat(clearIconCls, "-hidden"), !needClear), "".concat(clearIconCls, "-has-suffix"), !!suffix))
}, iconNode);
}
var affixWrapperPrefixCls = "".concat(prefixCls, "-affix-wrapper");
var affixWrapperCls = clsx(affixWrapperPrefixCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-disabled"), disabled), "".concat(affixWrapperPrefixCls, "-disabled"), disabled), "".concat(affixWrapperPrefixCls, "-focused"), focused), "".concat(affixWrapperPrefixCls, "-readonly"), readOnly), "".concat(affixWrapperPrefixCls, "-input-with-clear-btn"), suffix && allowClear && value), classes === null || classes === void 0 ? void 0 : classes.affixWrapper, classNames === null || classNames === void 0 ? void 0 : classNames.affixWrapper, classNames === null || classNames === void 0 ? void 0 : classNames.variant);
var suffixNode = (suffix || allowClear) && /*#__PURE__*/React.createElement("span", {
className: clsx("".concat(prefixCls, "-suffix"), classNames === null || classNames === void 0 ? void 0 : classNames.suffix),
style: styles === null || styles === void 0 ? void 0 : styles.suffix
}, clearIcon, suffix);
element = /*#__PURE__*/React.createElement(AffixWrapperComponent, _extends({
className: affixWrapperCls,
style: styles === null || styles === void 0 ? void 0 : styles.affixWrapper,
onClick: onInputClick
}, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.affixWrapper, {
ref: containerRef
}), prefix && /*#__PURE__*/React.createElement("span", {
className: clsx("".concat(prefixCls, "-prefix"), classNames === null || classNames === void 0 ? void 0 : classNames.prefix),
style: styles === null || styles === void 0 ? void 0 : styles.prefix
}, prefix), element, suffixNode);
}
// ================== Addon ================== //
if (hasAddon(props)) {
var wrapperCls = "".concat(prefixCls, "-group");
var addonCls = "".concat(wrapperCls, "-addon");
var groupWrapperCls = "".concat(wrapperCls, "-wrapper");
var mergedWrapperClassName = clsx("".concat(prefixCls, "-wrapper"), wrapperCls, classes === null || classes === void 0 ? void 0 : classes.wrapper, classNames === null || classNames === void 0 ? void 0 : classNames.wrapper);
var mergedGroupClassName = clsx(groupWrapperCls, _defineProperty({}, "".concat(groupWrapperCls, "-disabled"), disabled), classes === null || classes === void 0 ? void 0 : classes.group, classNames === null || classNames === void 0 ? void 0 : classNames.groupWrapper);
// Need another wrapper for changing display:table to display:inline-block
// and put style prop in wrapper
element = /*#__PURE__*/React.createElement(GroupWrapperComponent, {
className: mergedGroupClassName,
ref: groupRef
}, /*#__PURE__*/React.createElement(WrapperComponent, {
className: mergedWrapperClassName
}, addonBefore && /*#__PURE__*/React.createElement(GroupAddonComponent, {
className: addonCls
}, addonBefore), element, addonAfter && /*#__PURE__*/React.createElement(GroupAddonComponent, {
className: addonCls
}, addonAfter)));
}
// `className` and `style` are always on the root element
return /*#__PURE__*/React.cloneElement(element, {
className: clsx((_props2 = element.props) === null || _props2 === void 0 ? void 0 : _props2.className, className) || null,
style: _objectSpread(_objectSpread({}, (_props3 = element.props) === null || _props3 === void 0 ? void 0 : _props3.style), style),
hidden: hidden
});
});
export default BaseInput;

4
node_modules/rc-input/es/Input.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import React from 'react';
import type { InputProps, InputRef } from './interface';
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<InputRef>>;
export default Input;

235
node_modules/rc-input/es/Input.js generated vendored Normal file
View File

@@ -0,0 +1,235 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _extends from "@babel/runtime/helpers/esm/extends";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["autoComplete", "onChange", "onFocus", "onBlur", "onPressEnter", "onKeyDown", "onKeyUp", "prefixCls", "disabled", "htmlSize", "className", "maxLength", "suffix", "showCount", "count", "type", "classes", "classNames", "styles", "onCompositionStart", "onCompositionEnd"];
import clsx from 'classnames';
import useMergedState from "rc-util/es/hooks/useMergedState";
import omit from "rc-util/es/omit";
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
import BaseInput from "./BaseInput";
import useCount from "./hooks/useCount";
import { resolveOnChange, triggerFocus } from "./utils/commonUtils";
var Input = /*#__PURE__*/forwardRef(function (props, ref) {
var autoComplete = props.autoComplete,
onChange = props.onChange,
onFocus = props.onFocus,
onBlur = props.onBlur,
onPressEnter = props.onPressEnter,
onKeyDown = props.onKeyDown,
onKeyUp = props.onKeyUp,
_props$prefixCls = props.prefixCls,
prefixCls = _props$prefixCls === void 0 ? 'rc-input' : _props$prefixCls,
disabled = props.disabled,
htmlSize = props.htmlSize,
className = props.className,
maxLength = props.maxLength,
suffix = props.suffix,
showCount = props.showCount,
count = props.count,
_props$type = props.type,
type = _props$type === void 0 ? 'text' : _props$type,
classes = props.classes,
classNames = props.classNames,
styles = props.styles,
_onCompositionStart = props.onCompositionStart,
onCompositionEnd = props.onCompositionEnd,
rest = _objectWithoutProperties(props, _excluded);
var _useState = useState(false),
_useState2 = _slicedToArray(_useState, 2),
focused = _useState2[0],
setFocused = _useState2[1];
var compositionRef = useRef(false);
var keyLockRef = useRef(false);
var inputRef = useRef(null);
var holderRef = useRef(null);
var focus = function focus(option) {
if (inputRef.current) {
triggerFocus(inputRef.current, option);
}
};
// ====================== Value =======================
var _useMergedState = useMergedState(props.defaultValue, {
value: props.value
}),
_useMergedState2 = _slicedToArray(_useMergedState, 2),
value = _useMergedState2[0],
setValue = _useMergedState2[1];
var formatValue = value === undefined || value === null ? '' : String(value);
// =================== Select Range ===================
var _useState3 = useState(null),
_useState4 = _slicedToArray(_useState3, 2),
selection = _useState4[0],
setSelection = _useState4[1];
// ====================== Count =======================
var countConfig = useCount(count, showCount);
var mergedMax = countConfig.max || maxLength;
var valueLength = countConfig.strategy(formatValue);
var isOutOfRange = !!mergedMax && valueLength > mergedMax;
// ======================= Ref ========================
useImperativeHandle(ref, function () {
var _holderRef$current;
return {
focus: focus,
blur: function blur() {
var _inputRef$current;
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.blur();
},
setSelectionRange: function setSelectionRange(start, end, direction) {
var _inputRef$current2;
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.setSelectionRange(start, end, direction);
},
select: function select() {
var _inputRef$current3;
(_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 || _inputRef$current3.select();
},
input: inputRef.current,
nativeElement: ((_holderRef$current = holderRef.current) === null || _holderRef$current === void 0 ? void 0 : _holderRef$current.nativeElement) || inputRef.current
};
});
useEffect(function () {
if (keyLockRef.current) {
keyLockRef.current = false;
}
setFocused(function (prev) {
return prev && disabled ? false : prev;
});
}, [disabled]);
var triggerChange = function triggerChange(e, currentValue, info) {
var cutValue = currentValue;
if (!compositionRef.current && countConfig.exceedFormatter && countConfig.max && countConfig.strategy(currentValue) > countConfig.max) {
cutValue = countConfig.exceedFormatter(currentValue, {
max: countConfig.max
});
if (currentValue !== cutValue) {
var _inputRef$current4, _inputRef$current5;
setSelection([((_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.selectionStart) || 0, ((_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.selectionEnd) || 0]);
}
} else if (info.source === 'compositionEnd') {
// Avoid triggering twice
// https://github.com/ant-design/ant-design/issues/46587
return;
}
setValue(cutValue);
if (inputRef.current) {
resolveOnChange(inputRef.current, e, onChange, cutValue);
}
};
useEffect(function () {
if (selection) {
var _inputRef$current6;
(_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 || _inputRef$current6.setSelectionRange.apply(_inputRef$current6, _toConsumableArray(selection));
}
}, [selection]);
var onInternalChange = function onInternalChange(e) {
triggerChange(e, e.target.value, {
source: 'change'
});
};
var onInternalCompositionEnd = function onInternalCompositionEnd(e) {
compositionRef.current = false;
triggerChange(e, e.currentTarget.value, {
source: 'compositionEnd'
});
onCompositionEnd === null || onCompositionEnd === void 0 || onCompositionEnd(e);
};
var handleKeyDown = function handleKeyDown(e) {
if (onPressEnter && e.key === 'Enter' && !keyLockRef.current) {
keyLockRef.current = true;
onPressEnter(e);
}
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
};
var handleKeyUp = function handleKeyUp(e) {
if (e.key === 'Enter') {
keyLockRef.current = false;
}
onKeyUp === null || onKeyUp === void 0 || onKeyUp(e);
};
var handleFocus = function handleFocus(e) {
setFocused(true);
onFocus === null || onFocus === void 0 || onFocus(e);
};
var handleBlur = function handleBlur(e) {
if (keyLockRef.current) {
keyLockRef.current = false;
}
setFocused(false);
onBlur === null || onBlur === void 0 || onBlur(e);
};
var handleReset = function handleReset(e) {
setValue('');
focus();
if (inputRef.current) {
resolveOnChange(inputRef.current, e, onChange);
}
};
// ====================== Input =======================
var outOfRangeCls = isOutOfRange && "".concat(prefixCls, "-out-of-range");
var getInputElement = function getInputElement() {
// Fix https://fb.me/react-unknown-prop
var otherProps = omit(props, ['prefixCls', 'onPressEnter', 'addonBefore', 'addonAfter', 'prefix', 'suffix', 'allowClear',
// Input elements must be either controlled or uncontrolled,
// specify either the value prop, or the defaultValue prop, but not both.
'defaultValue', 'showCount', 'count', 'classes', 'htmlSize', 'styles', 'classNames', 'onClear']);
return /*#__PURE__*/React.createElement("input", _extends({
autoComplete: autoComplete
}, otherProps, {
onChange: onInternalChange,
onFocus: handleFocus,
onBlur: handleBlur,
onKeyDown: handleKeyDown,
onKeyUp: handleKeyUp,
className: clsx(prefixCls, _defineProperty({}, "".concat(prefixCls, "-disabled"), disabled), classNames === null || classNames === void 0 ? void 0 : classNames.input),
style: styles === null || styles === void 0 ? void 0 : styles.input,
ref: inputRef,
size: htmlSize,
type: type,
onCompositionStart: function onCompositionStart(e) {
compositionRef.current = true;
_onCompositionStart === null || _onCompositionStart === void 0 || _onCompositionStart(e);
},
onCompositionEnd: onInternalCompositionEnd
}));
};
var getSuffix = function getSuffix() {
// Max length value
var hasMaxLength = Number(mergedMax) > 0;
if (suffix || countConfig.show) {
var dataCount = countConfig.showFormatter ? countConfig.showFormatter({
value: formatValue,
count: valueLength,
maxLength: mergedMax
}) : "".concat(valueLength).concat(hasMaxLength ? " / ".concat(mergedMax) : '');
return /*#__PURE__*/React.createElement(React.Fragment, null, countConfig.show && /*#__PURE__*/React.createElement("span", {
className: clsx("".concat(prefixCls, "-show-count-suffix"), _defineProperty({}, "".concat(prefixCls, "-show-count-has-suffix"), !!suffix), classNames === null || classNames === void 0 ? void 0 : classNames.count),
style: _objectSpread({}, styles === null || styles === void 0 ? void 0 : styles.count)
}, dataCount), suffix);
}
return null;
};
// ====================== Render ======================
return /*#__PURE__*/React.createElement(BaseInput, _extends({}, rest, {
prefixCls: prefixCls,
className: clsx(className, outOfRangeCls),
handleReset: handleReset,
value: formatValue,
focused: focused,
triggerFocus: focus,
suffix: getSuffix(),
disabled: disabled,
classes: classes,
classNames: classNames,
styles: styles,
ref: holderRef
}), getInputElement());
});
export default Input;

12
node_modules/rc-input/es/hooks/useCount.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import type { InputProps } from '..';
import type { CountConfig, ShowCountFormatter } from '../interface';
type ForcedCountConfig = Omit<CountConfig, 'show'> & Pick<Required<CountConfig>, 'strategy'> & {
show: boolean;
showFormatter?: ShowCountFormatter;
};
/**
* Cut `value` by the `count.max` prop.
*/
export declare function inCountRange(value: string, countConfig: ForcedCountConfig): boolean;
export default function useCount(count?: CountConfig, showCount?: InputProps['showCount']): ForcedCountConfig;
export {};

34
node_modules/rc-input/es/hooks/useCount.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _typeof from "@babel/runtime/helpers/esm/typeof";
var _excluded = ["show"];
import * as React from 'react';
/**
* Cut `value` by the `count.max` prop.
*/
export function inCountRange(value, countConfig) {
if (!countConfig.max) {
return true;
}
var count = countConfig.strategy(value);
return count <= countConfig.max;
}
export default function useCount(count, showCount) {
return React.useMemo(function () {
var mergedConfig = {};
if (showCount) {
mergedConfig.show = _typeof(showCount) === 'object' && showCount.formatter ? showCount.formatter : !!showCount;
}
mergedConfig = _objectSpread(_objectSpread({}, mergedConfig), count);
var _ref = mergedConfig,
show = _ref.show,
rest = _objectWithoutProperties(_ref, _excluded);
return _objectSpread(_objectSpread({}, rest), {}, {
show: !!show,
showFormatter: typeof show === 'function' ? show : undefined,
strategy: rest.strategy || function (value) {
return value.length;
}
});
}, [count, showCount]);
}

5
node_modules/rc-input/es/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import BaseInput from './BaseInput';
import Input from './Input';
export { BaseInput };
export type { InputProps, InputRef } from './interface';
export default Input;

4
node_modules/rc-input/es/index.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import BaseInput from "./BaseInput";
import Input from "./Input";
export { BaseInput };
export default Input;

107
node_modules/rc-input/es/interface.d.ts generated vendored Normal file
View File

@@ -0,0 +1,107 @@
import type { CSSProperties, InputHTMLAttributes, KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode } from 'react';
import type { InputFocusOptions } from './utils/commonUtils';
import type { LiteralUnion } from './utils/types';
export interface CommonInputProps {
prefix?: ReactNode;
suffix?: ReactNode;
addonBefore?: ReactNode;
addonAfter?: ReactNode;
/** @deprecated Use `classNames` instead */
classes?: {
affixWrapper?: string;
group?: string;
wrapper?: string;
};
classNames?: {
affixWrapper?: string;
prefix?: string;
suffix?: string;
groupWrapper?: string;
wrapper?: string;
variant?: string;
};
styles?: {
affixWrapper?: CSSProperties;
prefix?: CSSProperties;
suffix?: CSSProperties;
};
allowClear?: boolean | {
clearIcon?: ReactNode;
};
}
type DataAttr = Record<`data-${string}`, string>;
export type ValueType = InputHTMLAttributes<HTMLInputElement>['value'] | bigint;
export interface BaseInputProps extends CommonInputProps {
value?: ValueType;
/** @deprecated Use `children` instead */
inputElement?: ReactElement;
prefixCls?: string;
className?: string;
style?: CSSProperties;
disabled?: boolean;
focused?: boolean;
triggerFocus?: () => void;
readOnly?: boolean;
handleReset?: MouseEventHandler;
onClear?: () => void;
hidden?: boolean;
dataAttrs?: {
affixWrapper?: DataAttr;
};
components?: {
affixWrapper?: 'span' | 'div';
groupWrapper?: 'span' | 'div';
wrapper?: 'span' | 'div';
groupAddon?: 'span' | 'div';
};
children: ReactElement;
}
export type ShowCountFormatter = (args: {
value: string;
count: number;
maxLength?: number;
}) => ReactNode;
export type ExceedFormatter = (value: string, config: {
max: number;
}) => string;
export interface CountConfig {
max?: number;
strategy?: (value: string) => number;
show?: boolean | ShowCountFormatter;
/** Trigger when content larger than the `max` limitation */
exceedFormatter?: ExceedFormatter;
}
export interface InputProps extends CommonInputProps, Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type' | 'value'> {
value?: ValueType;
prefixCls?: string;
type?: 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>;
onPressEnter?: KeyboardEventHandler<HTMLInputElement>;
/** It's better to use `count.show` instead */
showCount?: boolean | {
formatter: ShowCountFormatter;
};
autoComplete?: string;
htmlSize?: number;
classNames?: CommonInputProps['classNames'] & {
input?: string;
count?: string;
};
styles?: CommonInputProps['styles'] & {
input?: CSSProperties;
count?: CSSProperties;
};
count?: CountConfig;
onClear?: () => void;
}
export interface InputRef {
focus: (options?: InputFocusOptions) => void;
blur: () => void;
setSelectionRange: (start: number, end: number, direction?: 'forward' | 'backward' | 'none') => void;
select: () => void;
input: HTMLInputElement | null;
nativeElement: HTMLElement | null;
}
export interface ChangeEventInfo {
source: 'compositionEnd' | 'change';
}
export {};

1
node_modules/rc-input/es/interface.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

9
node_modules/rc-input/es/utils/commonUtils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import type React from 'react';
import type { BaseInputProps, InputProps } from '../interface';
export declare function hasAddon(props: BaseInputProps | InputProps): boolean;
export declare function hasPrefixSuffix(props: BaseInputProps | InputProps): boolean;
export declare function resolveOnChange<E extends HTMLInputElement | HTMLTextAreaElement>(target: E, e: React.ChangeEvent<E> | React.MouseEvent<HTMLElement, MouseEvent> | React.CompositionEvent<HTMLElement>, onChange: undefined | ((event: React.ChangeEvent<E>) => void), targetValue?: string): void;
export interface InputFocusOptions extends FocusOptions {
cursor?: 'start' | 'end' | 'all';
}
export declare function triggerFocus(element?: HTMLInputElement | HTMLTextAreaElement, option?: InputFocusOptions): void;

92
node_modules/rc-input/es/utils/commonUtils.js generated vendored Normal file
View File

@@ -0,0 +1,92 @@
export function hasAddon(props) {
return !!(props.addonBefore || props.addonAfter);
}
export function hasPrefixSuffix(props) {
return !!(props.prefix || props.suffix || props.allowClear);
}
// TODO: It's better to use `Proxy` replace the `element.value`. But we still need support IE11.
function cloneEvent(event, target, value) {
// A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of <input type="file"> elements.
// As of the last update, this bug was still marked as "NEW," indicating that it might not have been resolved yet.
// https://bugs.webkit.org/show_bug.cgi?id=28123
var currentTarget = target.cloneNode(true);
// click clear icon
var newEvent = Object.create(event, {
target: {
value: currentTarget
},
currentTarget: {
value: currentTarget
}
});
// Fill data
currentTarget.value = value;
// Fill selection. Some type like `email` not support selection
// https://github.com/ant-design/ant-design/issues/47833
if (typeof target.selectionStart === 'number' && typeof target.selectionEnd === 'number') {
currentTarget.selectionStart = target.selectionStart;
currentTarget.selectionEnd = target.selectionEnd;
}
currentTarget.setSelectionRange = function () {
target.setSelectionRange.apply(target, arguments);
};
return newEvent;
}
export function resolveOnChange(target, e, onChange, targetValue) {
if (!onChange) {
return;
}
var event = e;
if (e.type === 'click') {
// Clone a new target for event.
// Avoid the following usage, the setQuery method gets the original value.
//
// const [query, setQuery] = React.useState('');
// <Input
// allowClear
// value={query}
// onChange={(e)=> {
// setQuery((prevStatus) => e.target.value);
// }}
// />
event = cloneEvent(e, target, '');
onChange(event);
return;
}
// Trigger by composition event, this means we need force change the input value
// https://github.com/ant-design/ant-design/issues/45737
// https://github.com/ant-design/ant-design/issues/46598
if (target.type !== 'file' && targetValue !== undefined) {
event = cloneEvent(e, target, targetValue);
onChange(event);
return;
}
onChange(event);
}
export function triggerFocus(element, option) {
if (!element) return;
element.focus(option);
// Selection content
var _ref = option || {},
cursor = _ref.cursor;
if (cursor) {
var 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);
}
}
}

2
node_modules/rc-input/es/utils/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
/** https://github.com/Microsoft/TypeScript/issues/29729 */
export type LiteralUnion<T extends U, U> = T | (U & {});

1
node_modules/rc-input/es/utils/types.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};