first commit
This commit is contained in:
9
frontend/node_modules/rc-input/LICENSE.md
generated
vendored
Normal file
9
frontend/node_modules/rc-input/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019-present afc163
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
99
frontend/node_modules/rc-input/README.md
generated
vendored
Normal file
99
frontend/node_modules/rc-input/README.md
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
# rc-input ⌨️
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![npm download][download-image]][download-url]
|
||||
[![build status][github-actions-image]][github-actions-url]
|
||||
[![Codecov][codecov-image]][codecov-url]
|
||||
[![bundle size][bundlephobia-image]][bundlephobia-url]
|
||||
[![dumi][dumi-image]][dumi-url]
|
||||
|
||||
[npm-image]: http://img.shields.io/npm/v/rc-input.svg?style=flat-square
|
||||
[npm-url]: http://npmjs.org/package/rc-select
|
||||
[travis-image]: https://img.shields.io/travis/react-component/input/master?style=flat-square
|
||||
[travis-url]: https://travis-ci.com/react-component/input
|
||||
[github-actions-image]: https://github.com/react-component/input/workflows/CI/badge.svg
|
||||
[github-actions-url]: https://github.com/react-component/input/actions
|
||||
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/input/master.svg?style=flat-square
|
||||
[codecov-url]: https://app.codecov.io/gh/react-component/input
|
||||
[david-url]: https://david-dm.org/react-component/input
|
||||
[david-image]: https://david-dm.org/react-component/input/status.svg?style=flat-square
|
||||
[david-dev-url]: https://david-dm.org/react-component/input?type=dev
|
||||
[david-dev-image]: https://david-dm.org/react-component/input/dev-status.svg?style=flat-square
|
||||
[download-image]: https://img.shields.io/npm/dm/rc-select.svg?style=flat-square
|
||||
[download-url]: https://npmjs.org/package/rc-select
|
||||
[bundlephobia-url]: https://bundlephobia.com/package/rc-select
|
||||
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-select
|
||||
[dumi-url]: https://github.com/umijs/dumi
|
||||
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
|
||||
|
||||
## Install
|
||||
|
||||
[](https://npmjs.org/package/rc-input)
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import Input from 'rc-input';
|
||||
import { render } from 'react-dom';
|
||||
|
||||
render(<Input placeholder="input" allowClear />, mountNode);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
| Property | Type | Default | Description |
|
||||
| --------------------- | ---------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| prefixCls | string | rc-input | |
|
||||
| className | string | '' | additional class name of input |
|
||||
| style | React.CSSProperties | | style properties of input |
|
||||
| affixWrapperClassName | string | - | className with 'rc-input-affix-wrapper' |
|
||||
| groupClassName | string | - | className with 'rc-input-group-wrapper' |
|
||||
| wrapperClassName | string | - | className with 'rc-input-wrapper' |
|
||||
| addonAfter | ReactNode | - | The label text displayed after (on the right side of) the input field |
|
||||
| addonBefore | ReactNode | - | The label text displayed before (on the left side of) the input field |
|
||||
| allowClear | boolean | { clearIcon: ReactNode } | false | If allow to remove input content with clear icon |
|
||||
| bordered | boolean | true | Whether has border style |
|
||||
| defaultValue | string | - | The initial input content |
|
||||
| disabled | boolean | false | Whether the input is disabled |
|
||||
| id | string | - | The ID for input |
|
||||
| maxLength | number | - | The max length |
|
||||
| showCount | boolean | { formatter: ({ value: string, count: number, maxLength?: number }) => ReactNode } | false | Whether show text count |
|
||||
| prefix | ReactNode | - | The prefix icon for the Input |
|
||||
| suffix | ReactNode | - | The suffix icon for the Input |
|
||||
| type | string | `text` | The type of input, see: [MDN](https://developer.mozilla.org/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types)( use `Input.TextArea` instead of `type="textarea"`) |
|
||||
| value | string | - | The input content value |
|
||||
| onChange | function(e) | - | Callback when user input |
|
||||
| onPressEnter | function(e) | - | The callback function that is triggered when Enter key is pressed |
|
||||
|
||||
## inputRef
|
||||
|
||||
```tsx | pure
|
||||
const inputRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
inputRef.current.focus();// the input will get focus
|
||||
inputRef.current.blur();// the input will lose focus
|
||||
console.log(inputRef.current.input);// The origin input element
|
||||
}, []);
|
||||
// ....
|
||||
<Input ref={inputRef} />
|
||||
```
|
||||
|
||||
| Property | Type | Description |
|
||||
| -------- | --------------------------------------- | --------------------------------- |
|
||||
| focus | `(options?: InputFocusOptions) => void` | The input get focus when called |
|
||||
| blur | `() => void` | The input loses focus when called |
|
||||
| input | `HTMLInputElement \| null` | The origin input element |
|
||||
|
||||
|
||||
|
||||
## Development
|
||||
|
||||
```
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
rc-input is released under the MIT license.
|
||||
27
frontend/node_modules/rc-input/assets/index.css
generated
vendored
Normal file
27
frontend/node_modules/rc-input/assets/index.css
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
.rc-input-out-of-range {
|
||||
color: red;
|
||||
}
|
||||
.rc-input-affix-wrapper {
|
||||
padding: 2px 8px;
|
||||
overflow: hidden;
|
||||
border: 1px solid lightgray;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.rc-input-affix-wrapper:hover,
|
||||
.rc-input-affix-wrapper:focus-within {
|
||||
border-color: #000;
|
||||
}
|
||||
.rc-input-affix-wrapper input {
|
||||
padding: 0;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
.rc-input-clear-icon {
|
||||
padding: 0;
|
||||
font-size: 12px;
|
||||
background: none;
|
||||
border: none;
|
||||
}
|
||||
.rc-input-clear-icon-hidden {
|
||||
display: none;
|
||||
}
|
||||
34
frontend/node_modules/rc-input/assets/index.less
generated
vendored
Normal file
34
frontend/node_modules/rc-input/assets/index.less
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
.rc-input {
|
||||
&-out-of-range {
|
||||
color: red;
|
||||
}
|
||||
|
||||
&-affix-wrapper {
|
||||
padding: 2px 8px;
|
||||
overflow: hidden;
|
||||
border: 1px solid lightgray;
|
||||
border-radius: 2px;
|
||||
|
||||
&:hover,
|
||||
&:focus-within {
|
||||
border-color: #000;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 0;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
&-clear-icon {
|
||||
padding: 0;
|
||||
font-size: 12px;
|
||||
background: none;
|
||||
border: none;
|
||||
|
||||
&-hidden {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
8
frontend/node_modules/rc-input/es/BaseInput.d.ts
generated
vendored
Normal file
8
frontend/node_modules/rc-input/es/BaseInput.d.ts
generated
vendored
Normal 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
frontend/node_modules/rc-input/es/BaseInput.js
generated
vendored
Normal file
130
frontend/node_modules/rc-input/es/BaseInput.js
generated
vendored
Normal 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
frontend/node_modules/rc-input/es/Input.d.ts
generated
vendored
Normal file
4
frontend/node_modules/rc-input/es/Input.d.ts
generated
vendored
Normal 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
frontend/node_modules/rc-input/es/Input.js
generated
vendored
Normal file
235
frontend/node_modules/rc-input/es/Input.js
generated
vendored
Normal 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
frontend/node_modules/rc-input/es/hooks/useCount.d.ts
generated
vendored
Normal file
12
frontend/node_modules/rc-input/es/hooks/useCount.d.ts
generated
vendored
Normal 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
frontend/node_modules/rc-input/es/hooks/useCount.js
generated
vendored
Normal file
34
frontend/node_modules/rc-input/es/hooks/useCount.js
generated
vendored
Normal 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
frontend/node_modules/rc-input/es/index.d.ts
generated
vendored
Normal file
5
frontend/node_modules/rc-input/es/index.d.ts
generated
vendored
Normal 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
frontend/node_modules/rc-input/es/index.js
generated
vendored
Normal file
4
frontend/node_modules/rc-input/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import BaseInput from "./BaseInput";
|
||||
import Input from "./Input";
|
||||
export { BaseInput };
|
||||
export default Input;
|
||||
107
frontend/node_modules/rc-input/es/interface.d.ts
generated
vendored
Normal file
107
frontend/node_modules/rc-input/es/interface.d.ts
generated
vendored
Normal 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
frontend/node_modules/rc-input/es/interface.js
generated
vendored
Normal file
1
frontend/node_modules/rc-input/es/interface.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
9
frontend/node_modules/rc-input/es/utils/commonUtils.d.ts
generated
vendored
Normal file
9
frontend/node_modules/rc-input/es/utils/commonUtils.d.ts
generated
vendored
Normal 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
frontend/node_modules/rc-input/es/utils/commonUtils.js
generated
vendored
Normal file
92
frontend/node_modules/rc-input/es/utils/commonUtils.js
generated
vendored
Normal 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
frontend/node_modules/rc-input/es/utils/types.d.ts
generated
vendored
Normal file
2
frontend/node_modules/rc-input/es/utils/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/** https://github.com/Microsoft/TypeScript/issues/29729 */
|
||||
export type LiteralUnion<T extends U, U> = T | (U & {});
|
||||
1
frontend/node_modules/rc-input/es/utils/types.js
generated
vendored
Normal file
1
frontend/node_modules/rc-input/es/utils/types.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
8
frontend/node_modules/rc-input/lib/BaseInput.d.ts
generated
vendored
Normal file
8
frontend/node_modules/rc-input/lib/BaseInput.d.ts
generated
vendored
Normal 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;
|
||||
140
frontend/node_modules/rc-input/lib/BaseInput.js
generated
vendored
Normal file
140
frontend/node_modules/rc-input/lib/BaseInput.js
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
||||
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _commonUtils = require("./utils/commonUtils");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
var BaseInput = /*#__PURE__*/_react.default.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 = (0, _react.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 = (0, _commonUtils.hasPrefixSuffix)(props);
|
||||
var element = /*#__PURE__*/(0, _react.cloneElement)(inputElement, {
|
||||
value: value,
|
||||
className: (0, _classnames.default)((_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 = (0, _react.useRef)(null);
|
||||
_react.default.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 = (0, _typeof2.default)(allowClear) === 'object' && allowClear !== null && allowClear !== void 0 && allowClear.clearIcon ? allowClear.clearIcon : '✖';
|
||||
clearIcon = /*#__PURE__*/_react.default.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: (0, _classnames.default)(clearIconCls, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(clearIconCls, "-hidden"), !needClear), "".concat(clearIconCls, "-has-suffix"), !!suffix))
|
||||
}, iconNode);
|
||||
}
|
||||
var affixWrapperPrefixCls = "".concat(prefixCls, "-affix-wrapper");
|
||||
var affixWrapperCls = (0, _classnames.default)(affixWrapperPrefixCls, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".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.default.createElement("span", {
|
||||
className: (0, _classnames.default)("".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.default.createElement(AffixWrapperComponent, (0, _extends2.default)({
|
||||
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.default.createElement("span", {
|
||||
className: (0, _classnames.default)("".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 ((0, _commonUtils.hasAddon)(props)) {
|
||||
var wrapperCls = "".concat(prefixCls, "-group");
|
||||
var addonCls = "".concat(wrapperCls, "-addon");
|
||||
var groupWrapperCls = "".concat(wrapperCls, "-wrapper");
|
||||
var mergedWrapperClassName = (0, _classnames.default)("".concat(prefixCls, "-wrapper"), wrapperCls, classes === null || classes === void 0 ? void 0 : classes.wrapper, classNames === null || classNames === void 0 ? void 0 : classNames.wrapper);
|
||||
var mergedGroupClassName = (0, _classnames.default)(groupWrapperCls, (0, _defineProperty2.default)({}, "".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.default.createElement(GroupWrapperComponent, {
|
||||
className: mergedGroupClassName,
|
||||
ref: groupRef
|
||||
}, /*#__PURE__*/_react.default.createElement(WrapperComponent, {
|
||||
className: mergedWrapperClassName
|
||||
}, addonBefore && /*#__PURE__*/_react.default.createElement(GroupAddonComponent, {
|
||||
className: addonCls
|
||||
}, addonBefore), element, addonAfter && /*#__PURE__*/_react.default.createElement(GroupAddonComponent, {
|
||||
className: addonCls
|
||||
}, addonAfter)));
|
||||
}
|
||||
|
||||
// `className` and `style` are always on the root element
|
||||
return /*#__PURE__*/_react.default.cloneElement(element, {
|
||||
className: (0, _classnames.default)((_props2 = element.props) === null || _props2 === void 0 ? void 0 : _props2.className, className) || null,
|
||||
style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (_props3 = element.props) === null || _props3 === void 0 ? void 0 : _props3.style), style),
|
||||
hidden: hidden
|
||||
});
|
||||
});
|
||||
var _default = exports.default = BaseInput;
|
||||
4
frontend/node_modules/rc-input/lib/Input.d.ts
generated
vendored
Normal file
4
frontend/node_modules/rc-input/lib/Input.d.ts
generated
vendored
Normal 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;
|
||||
245
frontend/node_modules/rc-input/lib/Input.js
generated
vendored
Normal file
245
frontend/node_modules/rc-input/lib/Input.js
generated
vendored
Normal file
@@ -0,0 +1,245 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
var _typeof = require("@babel/runtime/helpers/typeof");
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
||||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
||||
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
||||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
var _useMergedState3 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
||||
var _omit = _interopRequireDefault(require("rc-util/lib/omit"));
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _BaseInput = _interopRequireDefault(require("./BaseInput"));
|
||||
var _useCount = _interopRequireDefault(require("./hooks/useCount"));
|
||||
var _commonUtils = require("./utils/commonUtils");
|
||||
var _excluded = ["autoComplete", "onChange", "onFocus", "onBlur", "onPressEnter", "onKeyDown", "onKeyUp", "prefixCls", "disabled", "htmlSize", "className", "maxLength", "suffix", "showCount", "count", "type", "classes", "classNames", "styles", "onCompositionStart", "onCompositionEnd"];
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
var Input = /*#__PURE__*/(0, _react.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 = (0, _objectWithoutProperties2.default)(props, _excluded);
|
||||
var _useState = (0, _react.useState)(false),
|
||||
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
||||
focused = _useState2[0],
|
||||
setFocused = _useState2[1];
|
||||
var compositionRef = (0, _react.useRef)(false);
|
||||
var keyLockRef = (0, _react.useRef)(false);
|
||||
var inputRef = (0, _react.useRef)(null);
|
||||
var holderRef = (0, _react.useRef)(null);
|
||||
var focus = function focus(option) {
|
||||
if (inputRef.current) {
|
||||
(0, _commonUtils.triggerFocus)(inputRef.current, option);
|
||||
}
|
||||
};
|
||||
|
||||
// ====================== Value =======================
|
||||
var _useMergedState = (0, _useMergedState3.default)(props.defaultValue, {
|
||||
value: props.value
|
||||
}),
|
||||
_useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2),
|
||||
value = _useMergedState2[0],
|
||||
setValue = _useMergedState2[1];
|
||||
var formatValue = value === undefined || value === null ? '' : String(value);
|
||||
|
||||
// =================== Select Range ===================
|
||||
var _useState3 = (0, _react.useState)(null),
|
||||
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
||||
selection = _useState4[0],
|
||||
setSelection = _useState4[1];
|
||||
|
||||
// ====================== Count =======================
|
||||
var countConfig = (0, _useCount.default)(count, showCount);
|
||||
var mergedMax = countConfig.max || maxLength;
|
||||
var valueLength = countConfig.strategy(formatValue);
|
||||
var isOutOfRange = !!mergedMax && valueLength > mergedMax;
|
||||
|
||||
// ======================= Ref ========================
|
||||
(0, _react.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
|
||||
};
|
||||
});
|
||||
(0, _react.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) {
|
||||
(0, _commonUtils.resolveOnChange)(inputRef.current, e, onChange, cutValue);
|
||||
}
|
||||
};
|
||||
(0, _react.useEffect)(function () {
|
||||
if (selection) {
|
||||
var _inputRef$current6;
|
||||
(_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 || _inputRef$current6.setSelectionRange.apply(_inputRef$current6, (0, _toConsumableArray2.default)(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) {
|
||||
(0, _commonUtils.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 = (0, _omit.default)(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.default.createElement("input", (0, _extends2.default)({
|
||||
autoComplete: autoComplete
|
||||
}, otherProps, {
|
||||
onChange: onInternalChange,
|
||||
onFocus: handleFocus,
|
||||
onBlur: handleBlur,
|
||||
onKeyDown: handleKeyDown,
|
||||
onKeyUp: handleKeyUp,
|
||||
className: (0, _classnames.default)(prefixCls, (0, _defineProperty2.default)({}, "".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.default.createElement(_react.default.Fragment, null, countConfig.show && /*#__PURE__*/_react.default.createElement("span", {
|
||||
className: (0, _classnames.default)("".concat(prefixCls, "-show-count-suffix"), (0, _defineProperty2.default)({}, "".concat(prefixCls, "-show-count-has-suffix"), !!suffix), classNames === null || classNames === void 0 ? void 0 : classNames.count),
|
||||
style: (0, _objectSpread2.default)({}, styles === null || styles === void 0 ? void 0 : styles.count)
|
||||
}, dataCount), suffix);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
// ====================== Render ======================
|
||||
return /*#__PURE__*/_react.default.createElement(_BaseInput.default, (0, _extends2.default)({}, rest, {
|
||||
prefixCls: prefixCls,
|
||||
className: (0, _classnames.default)(className, outOfRangeCls),
|
||||
handleReset: handleReset,
|
||||
value: formatValue,
|
||||
focused: focused,
|
||||
triggerFocus: focus,
|
||||
suffix: getSuffix(),
|
||||
disabled: disabled,
|
||||
classes: classes,
|
||||
classNames: classNames,
|
||||
styles: styles,
|
||||
ref: holderRef
|
||||
}), getInputElement());
|
||||
});
|
||||
var _default = exports.default = Input;
|
||||
12
frontend/node_modules/rc-input/lib/hooks/useCount.d.ts
generated
vendored
Normal file
12
frontend/node_modules/rc-input/lib/hooks/useCount.d.ts
generated
vendored
Normal 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 {};
|
||||
45
frontend/node_modules/rc-input/lib/hooks/useCount.js
generated
vendored
Normal file
45
frontend/node_modules/rc-input/lib/hooks/useCount.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = useCount;
|
||||
exports.inCountRange = inCountRange;
|
||||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
||||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
||||
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _excluded = ["show"];
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Cut `value` by the `count.max` prop.
|
||||
*/
|
||||
function inCountRange(value, countConfig) {
|
||||
if (!countConfig.max) {
|
||||
return true;
|
||||
}
|
||||
var count = countConfig.strategy(value);
|
||||
return count <= countConfig.max;
|
||||
}
|
||||
function useCount(count, showCount) {
|
||||
return React.useMemo(function () {
|
||||
var mergedConfig = {};
|
||||
if (showCount) {
|
||||
mergedConfig.show = (0, _typeof2.default)(showCount) === 'object' && showCount.formatter ? showCount.formatter : !!showCount;
|
||||
}
|
||||
mergedConfig = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, mergedConfig), count);
|
||||
var _ref = mergedConfig,
|
||||
show = _ref.show,
|
||||
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
||||
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, rest), {}, {
|
||||
show: !!show,
|
||||
showFormatter: typeof show === 'function' ? show : undefined,
|
||||
strategy: rest.strategy || function (value) {
|
||||
return value.length;
|
||||
}
|
||||
});
|
||||
}, [count, showCount]);
|
||||
}
|
||||
5
frontend/node_modules/rc-input/lib/index.d.ts
generated
vendored
Normal file
5
frontend/node_modules/rc-input/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import BaseInput from './BaseInput';
|
||||
import Input from './Input';
|
||||
export { BaseInput };
|
||||
export type { InputProps, InputRef } from './interface';
|
||||
export default Input;
|
||||
16
frontend/node_modules/rc-input/lib/index.js
generated
vendored
Normal file
16
frontend/node_modules/rc-input/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "BaseInput", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _BaseInput.default;
|
||||
}
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _BaseInput = _interopRequireDefault(require("./BaseInput"));
|
||||
var _Input = _interopRequireDefault(require("./Input"));
|
||||
var _default = exports.default = _Input.default;
|
||||
107
frontend/node_modules/rc-input/lib/interface.d.ts
generated
vendored
Normal file
107
frontend/node_modules/rc-input/lib/interface.d.ts
generated
vendored
Normal 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 {};
|
||||
5
frontend/node_modules/rc-input/lib/interface.js
generated
vendored
Normal file
5
frontend/node_modules/rc-input/lib/interface.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
9
frontend/node_modules/rc-input/lib/utils/commonUtils.d.ts
generated
vendored
Normal file
9
frontend/node_modules/rc-input/lib/utils/commonUtils.d.ts
generated
vendored
Normal 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;
|
||||
101
frontend/node_modules/rc-input/lib/utils/commonUtils.js
generated
vendored
Normal file
101
frontend/node_modules/rc-input/lib/utils/commonUtils.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.hasAddon = hasAddon;
|
||||
exports.hasPrefixSuffix = hasPrefixSuffix;
|
||||
exports.resolveOnChange = resolveOnChange;
|
||||
exports.triggerFocus = triggerFocus;
|
||||
function hasAddon(props) {
|
||||
return !!(props.addonBefore || props.addonAfter);
|
||||
}
|
||||
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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
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
frontend/node_modules/rc-input/lib/utils/types.d.ts
generated
vendored
Normal file
2
frontend/node_modules/rc-input/lib/utils/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/** https://github.com/Microsoft/TypeScript/issues/29729 */
|
||||
export type LiteralUnion<T extends U, U> = T | (U & {});
|
||||
5
frontend/node_modules/rc-input/lib/utils/types.js
generated
vendored
Normal file
5
frontend/node_modules/rc-input/lib/utils/types.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
97
frontend/node_modules/rc-input/package.json
generated
vendored
Normal file
97
frontend/node_modules/rc-input/package.json
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
{
|
||||
"name": "rc-input",
|
||||
"version": "1.8.0",
|
||||
"description": "React input component",
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-component",
|
||||
"react-input",
|
||||
"input",
|
||||
"antd",
|
||||
"ant-design"
|
||||
],
|
||||
"main": "./lib/index",
|
||||
"module": "./es/index",
|
||||
"files": [
|
||||
"assets/*.css",
|
||||
"assets/*.less",
|
||||
"es",
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/react-component/input",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:react-component/input.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/react-component/input/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"start": "dumi dev",
|
||||
"docs:build": "dumi build",
|
||||
"docs:deploy": "gh-pages -d .doc",
|
||||
"compile": "father build && lessc assets/index.less assets/index.css",
|
||||
"gh-pages": "GH_PAGES=1 npm run docs:build && npm run docs:deploy",
|
||||
"prepublishOnly": "npm run compile && np --yolo --no-publish --branch antd-5.x",
|
||||
"postpublish": "npm run gh-pages",
|
||||
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",
|
||||
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
|
||||
"pretty-quick": "pretty-quick",
|
||||
"lint-staged": "lint-staged",
|
||||
"test": "rc-test",
|
||||
"coverage": "rc-test --coverage",
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.11.1",
|
||||
"classnames": "^2.2.1",
|
||||
"rc-util": "^5.18.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/jest-dom": "^6.6.3",
|
||||
"@testing-library/react": "^16.0.1",
|
||||
"@testing-library/user-event": "^14.0.0-beta",
|
||||
"@types/classnames": "^2.2.9",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.1",
|
||||
"@umijs/fabric": "^4.0.0",
|
||||
"coveralls": "^3.0.6",
|
||||
"cross-env": "^7.0.2",
|
||||
"dumi": "^2.1.14",
|
||||
"eslint": "^8.0.0",
|
||||
"father": "^4.3.7",
|
||||
"gh-pages": "^6.2.0",
|
||||
"husky": "^9.1.7",
|
||||
"less": "^4.2.1",
|
||||
"lint-staged": "^15.2.11",
|
||||
"np": "^10.1.0",
|
||||
"prettier": "^3.4.2",
|
||||
"pretty-quick": "^4.0.0",
|
||||
"rc-test": "^7.0.15",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0",
|
||||
"typescript": "^5.7.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.0.0",
|
||||
"react-dom": ">=16.0.0"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "pretty-quick --staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"**/*.{js,jsx,tsx,ts,md,json}": [
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"cnpm": {
|
||||
"mode": "npm"
|
||||
},
|
||||
"tnpm": {
|
||||
"mode": "npm"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user