first commit
This commit is contained in:
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
|
||||
});
|
||||
Reference in New Issue
Block a user