add all frontend files

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

9
node_modules/rc-textarea/LICENSE.md generated vendored Normal file
View 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.

55
node_modules/rc-textarea/README.md generated vendored Normal file
View File

@@ -0,0 +1,55 @@
# rc-textarea
[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![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]
[npm-image]: http://img.shields.io/npm/v/rc-textarea.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-textarea
[github-actions-image]: https://github.com/react-component/textarea/workflows/CI/badge.svg
[github-actions-url]: https://github.com/react-component/textarea/actions
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/textarea/master.svg?style=flat-square
[codecov-url]: https://codecov.io/gh/react-component/textarea/branch/master
[download-image]: https://img.shields.io/npm/dm/rc-textarea.svg?style=flat-square
[download-url]: https://npmjs.org/package/rc-textarea
[bundlephobia-url]: https://bundlephobia.com/result?p=rc-textarea
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-textarea
Pretty Textarea react component used in [ant.design](https://ant.design).
## Live Demo
https://react-component.github.io/textarea/
## Install
[![rc-textarea](https://nodei.co/npm/rc-textarea.png)](https://npmjs.org/package/rc-textarea)
## Usage
```js
import Textarea from 'rc-textarea';
import { render } from 'react-dom';
render(<Textarea />, mountNode);
```
## API
| Property | Type | Default | Description |
| ------------ | --------------------------- | ----------- | ---------------------------------------------------------------------------------------------- |
| prefixCls | string | rc-textarea | |
| className | string | '' | additional class name of textarea |
| style | React.CSSProperties | - | style properties of textarea |
| autoSize | boolean \| object | - | Height autosize feature, can be set to `true\|false` or an object `{ minRows: 2, maxRows: 6 }` |
| onPressEnter | function(e) | - | The callback function that is triggered when Enter key is pressed |
| onResize | function({ width, height }) | - | The callback function that is triggered when resize |
## Development
```
npm install
npm start
```
## License
rc-textarea is released under the MIT license.

15
node_modules/rc-textarea/assets/index.css generated vendored Normal file
View File

@@ -0,0 +1,15 @@
.rc-textarea-affix-wrapper {
display: inline-block;
box-sizing: border-box;
}
.rc-textarea-affix-wrapper textarea {
box-sizing: border-box;
width: 100%;
height: 100%;
padding: 0;
border: 1px solid #1677ff;
}
.rc-textarea-out-of-range,
.rc-textarea-out-of-range textarea {
color: red;
}

21
node_modules/rc-textarea/assets/index.less generated vendored Normal file
View File

@@ -0,0 +1,21 @@
@textarea-prefix-cls: rc-textarea;
.rc-textarea-affix-wrapper {
display: inline-block;
box-sizing: border-box;
textarea {
box-sizing: border-box;
width: 100%;
height: 100%;
padding: 0;
border: 1px solid #1677ff;
}
}
.@{textarea-prefix-cls}-out-of-range {
&,
& textarea {
color: red;
}
}

30
node_modules/rc-textarea/es/ResizableTextArea.d.ts generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import * as React from 'react';
import type { ResizableTextAreaRef } from './interface';
declare const ResizableTextArea: React.ForwardRefExoticComponent<Omit<import("./interface").HTMLTextareaProps, "value" | "onResize"> & {
value?: string | number | bigint | readonly string[];
prefixCls?: string;
className?: string;
style?: React.CSSProperties;
autoSize?: boolean | import("./interface").AutoSizeType;
onPressEnter?: React.KeyboardEventHandler<HTMLTextAreaElement>;
onResize?: (size: {
width: number;
height: number;
}) => void;
classNames?: {
affixWrapper?: string;
prefix?: string;
suffix?: string;
groupWrapper?: string;
wrapper?: string;
variant?: string;
} & {
textarea?: string;
count?: string;
};
styles?: {
textarea?: React.CSSProperties;
count?: React.CSSProperties;
};
} & Pick<import("rc-input/lib/interface").BaseInputProps, "allowClear" | "suffix"> & Pick<import("rc-input").InputProps, "showCount" | "count" | "onClear"> & React.RefAttributes<ResizableTextAreaRef>>;
export default ResizableTextArea;

154
node_modules/rc-textarea/es/ResizableTextArea.js generated vendored Normal file
View File

@@ -0,0 +1,154 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _typeof from "@babel/runtime/helpers/esm/typeof";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["prefixCls", "defaultValue", "value", "autoSize", "onResize", "className", "style", "disabled", "onChange", "onInternalAutoSize"];
import classNames from 'classnames';
import ResizeObserver from 'rc-resize-observer';
import useLayoutEffect from "rc-util/es/hooks/useLayoutEffect";
import useMergedState from "rc-util/es/hooks/useMergedState";
import raf from "rc-util/es/raf";
import * as React from 'react';
import calculateAutoSizeStyle from "./calculateNodeHeight";
var RESIZE_START = 0;
var RESIZE_MEASURING = 1;
var RESIZE_STABLE = 2;
var ResizableTextArea = /*#__PURE__*/React.forwardRef(function (props, ref) {
var _ref = props,
prefixCls = _ref.prefixCls,
defaultValue = _ref.defaultValue,
value = _ref.value,
autoSize = _ref.autoSize,
onResize = _ref.onResize,
className = _ref.className,
style = _ref.style,
disabled = _ref.disabled,
onChange = _ref.onChange,
onInternalAutoSize = _ref.onInternalAutoSize,
restProps = _objectWithoutProperties(_ref, _excluded);
// =============================== Value ================================
var _useMergedState = useMergedState(defaultValue, {
value: value,
postState: function postState(val) {
return val !== null && val !== void 0 ? val : '';
}
}),
_useMergedState2 = _slicedToArray(_useMergedState, 2),
mergedValue = _useMergedState2[0],
setMergedValue = _useMergedState2[1];
var onInternalChange = function onInternalChange(event) {
setMergedValue(event.target.value);
onChange === null || onChange === void 0 || onChange(event);
};
// ================================ Ref =================================
var textareaRef = React.useRef();
React.useImperativeHandle(ref, function () {
return {
textArea: textareaRef.current
};
});
// ============================== AutoSize ==============================
var _React$useMemo = React.useMemo(function () {
if (autoSize && _typeof(autoSize) === 'object') {
return [autoSize.minRows, autoSize.maxRows];
}
return [];
}, [autoSize]),
_React$useMemo2 = _slicedToArray(_React$useMemo, 2),
minRows = _React$useMemo2[0],
maxRows = _React$useMemo2[1];
var needAutoSize = !!autoSize;
// =============================== Resize ===============================
var _React$useState = React.useState(RESIZE_STABLE),
_React$useState2 = _slicedToArray(_React$useState, 2),
resizeState = _React$useState2[0],
setResizeState = _React$useState2[1];
var _React$useState3 = React.useState(),
_React$useState4 = _slicedToArray(_React$useState3, 2),
autoSizeStyle = _React$useState4[0],
setAutoSizeStyle = _React$useState4[1];
var startResize = function startResize() {
setResizeState(RESIZE_START);
if (process.env.NODE_ENV === 'test') {
onInternalAutoSize === null || onInternalAutoSize === void 0 || onInternalAutoSize();
}
};
// Change to trigger resize measure
useLayoutEffect(function () {
if (needAutoSize) {
startResize();
}
}, [value, minRows, maxRows, needAutoSize]);
useLayoutEffect(function () {
if (resizeState === RESIZE_START) {
setResizeState(RESIZE_MEASURING);
} else if (resizeState === RESIZE_MEASURING) {
var textareaStyles = calculateAutoSizeStyle(textareaRef.current, false, minRows, maxRows);
// Safari has bug that text will keep break line on text cut when it's prev is break line.
// ZombieJ: This not often happen. So we just skip it.
// const { selectionStart, selectionEnd, scrollTop } = textareaRef.current;
// const { value: tmpValue } = textareaRef.current;
// textareaRef.current.value = '';
// textareaRef.current.value = tmpValue;
// if (document.activeElement === textareaRef.current) {
// textareaRef.current.scrollTop = scrollTop;
// textareaRef.current.setSelectionRange(selectionStart, selectionEnd);
// }
setResizeState(RESIZE_STABLE);
setAutoSizeStyle(textareaStyles);
} else {
// https://github.com/react-component/textarea/pull/23
// Firefox has blink issue before but fixed in latest version.
}
}, [resizeState]);
// We lock resize trigger by raf to avoid Safari warning
var resizeRafRef = React.useRef();
var cleanRaf = function cleanRaf() {
raf.cancel(resizeRafRef.current);
};
var onInternalResize = function onInternalResize(size) {
if (resizeState === RESIZE_STABLE) {
onResize === null || onResize === void 0 || onResize(size);
if (autoSize) {
cleanRaf();
resizeRafRef.current = raf(function () {
startResize();
});
}
}
};
React.useEffect(function () {
return cleanRaf;
}, []);
// =============================== Render ===============================
var mergedAutoSizeStyle = needAutoSize ? autoSizeStyle : null;
var mergedStyle = _objectSpread(_objectSpread({}, style), mergedAutoSizeStyle);
if (resizeState === RESIZE_START || resizeState === RESIZE_MEASURING) {
mergedStyle.overflowY = 'hidden';
mergedStyle.overflowX = 'hidden';
}
return /*#__PURE__*/React.createElement(ResizeObserver, {
onResize: onInternalResize,
disabled: !(autoSize || onResize)
}, /*#__PURE__*/React.createElement("textarea", _extends({}, restProps, {
ref: textareaRef,
style: mergedStyle,
className: classNames(prefixCls, className, _defineProperty({}, "".concat(prefixCls, "-disabled"), disabled)),
disabled: disabled,
value: mergedValue,
onChange: onInternalChange
})));
});
export default ResizableTextArea;

30
node_modules/rc-textarea/es/TextArea.d.ts generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import React from 'react';
import type { TextAreaRef } from './interface';
declare const TextArea: React.ForwardRefExoticComponent<Omit<import("./interface").HTMLTextareaProps, "value" | "onResize"> & {
value?: string | number | bigint | readonly string[];
prefixCls?: string;
className?: string;
style?: React.CSSProperties;
autoSize?: boolean | import("./interface").AutoSizeType;
onPressEnter?: React.KeyboardEventHandler<HTMLTextAreaElement>;
onResize?: (size: {
width: number;
height: number;
}) => void;
classNames?: {
affixWrapper?: string;
prefix?: string;
suffix?: string;
groupWrapper?: string;
wrapper?: string;
variant?: string;
} & {
textarea?: string;
count?: string;
};
styles?: {
textarea?: React.CSSProperties;
count?: React.CSSProperties;
};
} & Pick<import("rc-input/lib/interface").BaseInputProps, "allowClear" | "suffix"> & Pick<import("rc-input").InputProps, "showCount" | "count" | "onClear"> & React.RefAttributes<TextAreaRef>>;
export default TextArea;

228
node_modules/rc-textarea/es/TextArea.js generated vendored Normal file
View File

@@ -0,0 +1,228 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
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 = ["defaultValue", "value", "onFocus", "onBlur", "onChange", "allowClear", "maxLength", "onCompositionStart", "onCompositionEnd", "suffix", "prefixCls", "showCount", "count", "className", "style", "disabled", "hidden", "classNames", "styles", "onResize", "onClear", "onPressEnter", "readOnly", "autoSize", "onKeyDown"];
import clsx from 'classnames';
import { BaseInput } from 'rc-input';
import useCount from "rc-input/es/hooks/useCount";
import { resolveOnChange } from "rc-input/es/utils/commonUtils";
import useMergedState from "rc-util/es/hooks/useMergedState";
import React, { useEffect, useImperativeHandle, useRef } from 'react';
import ResizableTextArea from "./ResizableTextArea";
var TextArea = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var _countConfig$max;
var defaultValue = _ref.defaultValue,
customValue = _ref.value,
onFocus = _ref.onFocus,
onBlur = _ref.onBlur,
onChange = _ref.onChange,
allowClear = _ref.allowClear,
maxLength = _ref.maxLength,
onCompositionStart = _ref.onCompositionStart,
onCompositionEnd = _ref.onCompositionEnd,
suffix = _ref.suffix,
_ref$prefixCls = _ref.prefixCls,
prefixCls = _ref$prefixCls === void 0 ? 'rc-textarea' : _ref$prefixCls,
showCount = _ref.showCount,
count = _ref.count,
className = _ref.className,
style = _ref.style,
disabled = _ref.disabled,
hidden = _ref.hidden,
classNames = _ref.classNames,
styles = _ref.styles,
onResize = _ref.onResize,
onClear = _ref.onClear,
onPressEnter = _ref.onPressEnter,
readOnly = _ref.readOnly,
autoSize = _ref.autoSize,
onKeyDown = _ref.onKeyDown,
rest = _objectWithoutProperties(_ref, _excluded);
var _useMergedState = useMergedState(defaultValue, {
value: customValue,
defaultValue: defaultValue
}),
_useMergedState2 = _slicedToArray(_useMergedState, 2),
value = _useMergedState2[0],
setValue = _useMergedState2[1];
var formatValue = value === undefined || value === null ? '' : String(value);
var _React$useState = React.useState(false),
_React$useState2 = _slicedToArray(_React$useState, 2),
focused = _React$useState2[0],
setFocused = _React$useState2[1];
var compositionRef = React.useRef(false);
var _React$useState3 = React.useState(null),
_React$useState4 = _slicedToArray(_React$useState3, 2),
textareaResized = _React$useState4[0],
setTextareaResized = _React$useState4[1];
// =============================== Ref ================================
var holderRef = useRef(null);
var resizableTextAreaRef = useRef(null);
var getTextArea = function getTextArea() {
var _resizableTextAreaRef;
return (_resizableTextAreaRef = resizableTextAreaRef.current) === null || _resizableTextAreaRef === void 0 ? void 0 : _resizableTextAreaRef.textArea;
};
var focus = function focus() {
getTextArea().focus();
};
useImperativeHandle(ref, function () {
var _holderRef$current;
return {
resizableTextArea: resizableTextAreaRef.current,
focus: focus,
blur: function blur() {
getTextArea().blur();
},
nativeElement: ((_holderRef$current = holderRef.current) === null || _holderRef$current === void 0 ? void 0 : _holderRef$current.nativeElement) || getTextArea()
};
});
useEffect(function () {
setFocused(function (prev) {
return !disabled && prev;
});
}, [disabled]);
// =========================== Select Range ===========================
var _React$useState5 = React.useState(null),
_React$useState6 = _slicedToArray(_React$useState5, 2),
selection = _React$useState6[0],
setSelection = _React$useState6[1];
React.useEffect(function () {
if (selection) {
var _getTextArea;
(_getTextArea = getTextArea()).setSelectionRange.apply(_getTextArea, _toConsumableArray(selection));
}
}, [selection]);
// ============================== Count ===============================
var countConfig = useCount(count, showCount);
var mergedMax = (_countConfig$max = countConfig.max) !== null && _countConfig$max !== void 0 ? _countConfig$max : maxLength;
// Max length value
var hasMaxLength = Number(mergedMax) > 0;
var valueLength = countConfig.strategy(formatValue);
var isOutOfRange = !!mergedMax && valueLength > mergedMax;
// ============================== Change ==============================
var triggerChange = function triggerChange(e, currentValue) {
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) {
setSelection([getTextArea().selectionStart || 0, getTextArea().selectionEnd || 0]);
}
}
setValue(cutValue);
resolveOnChange(e.currentTarget, e, onChange, cutValue);
};
// =========================== Value Update ===========================
var onInternalCompositionStart = function onInternalCompositionStart(e) {
compositionRef.current = true;
onCompositionStart === null || onCompositionStart === void 0 || onCompositionStart(e);
};
var onInternalCompositionEnd = function onInternalCompositionEnd(e) {
compositionRef.current = false;
triggerChange(e, e.currentTarget.value);
onCompositionEnd === null || onCompositionEnd === void 0 || onCompositionEnd(e);
};
var onInternalChange = function onInternalChange(e) {
triggerChange(e, e.target.value);
};
var handleKeyDown = function handleKeyDown(e) {
if (e.key === 'Enter' && onPressEnter) {
onPressEnter(e);
}
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
};
var handleFocus = function handleFocus(e) {
setFocused(true);
onFocus === null || onFocus === void 0 || onFocus(e);
};
var handleBlur = function handleBlur(e) {
setFocused(false);
onBlur === null || onBlur === void 0 || onBlur(e);
};
// ============================== Reset ===============================
var handleReset = function handleReset(e) {
setValue('');
focus();
resolveOnChange(getTextArea(), e, onChange);
};
var suffixNode = suffix;
var dataCount;
if (countConfig.show) {
if (countConfig.showFormatter) {
dataCount = countConfig.showFormatter({
value: formatValue,
count: valueLength,
maxLength: mergedMax
});
} else {
dataCount = "".concat(valueLength).concat(hasMaxLength ? " / ".concat(mergedMax) : '');
}
suffixNode = /*#__PURE__*/React.createElement(React.Fragment, null, suffixNode, /*#__PURE__*/React.createElement("span", {
className: clsx("".concat(prefixCls, "-data-count"), classNames === null || classNames === void 0 ? void 0 : classNames.count),
style: styles === null || styles === void 0 ? void 0 : styles.count
}, dataCount));
}
var handleResize = function handleResize(size) {
var _getTextArea2;
onResize === null || onResize === void 0 || onResize(size);
if ((_getTextArea2 = getTextArea()) !== null && _getTextArea2 !== void 0 && _getTextArea2.style.height) {
setTextareaResized(true);
}
};
var isPureTextArea = !autoSize && !showCount && !allowClear;
return /*#__PURE__*/React.createElement(BaseInput, {
ref: holderRef,
value: formatValue,
allowClear: allowClear,
handleReset: handleReset,
suffix: suffixNode,
prefixCls: prefixCls,
classNames: _objectSpread(_objectSpread({}, classNames), {}, {
affixWrapper: clsx(classNames === null || classNames === void 0 ? void 0 : classNames.affixWrapper, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-show-count"), showCount), "".concat(prefixCls, "-textarea-allow-clear"), allowClear))
}),
disabled: disabled,
focused: focused,
className: clsx(className, isOutOfRange && "".concat(prefixCls, "-out-of-range")),
style: _objectSpread(_objectSpread({}, style), textareaResized && !isPureTextArea ? {
height: 'auto'
} : {}),
dataAttrs: {
affixWrapper: {
'data-count': typeof dataCount === 'string' ? dataCount : undefined
}
},
hidden: hidden,
readOnly: readOnly,
onClear: onClear
}, /*#__PURE__*/React.createElement(ResizableTextArea, _extends({}, rest, {
autoSize: autoSize,
maxLength: maxLength,
onKeyDown: handleKeyDown,
onChange: onInternalChange,
onFocus: handleFocus,
onBlur: handleBlur,
onCompositionStart: onInternalCompositionStart,
onCompositionEnd: onInternalCompositionEnd,
className: clsx(classNames === null || classNames === void 0 ? void 0 : classNames.textarea),
style: _objectSpread(_objectSpread({}, styles === null || styles === void 0 ? void 0 : styles.textarea), {}, {
resize: style === null || style === void 0 ? void 0 : style.resize
}),
disabled: disabled,
prefixCls: prefixCls,
onResize: handleResize,
ref: resizableTextAreaRef,
readOnly: readOnly
})));
});
export default TextArea;

9
node_modules/rc-textarea/es/calculateNodeHeight.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import type React from 'react';
export interface NodeType {
sizingStyle: string;
paddingSize: number;
borderSize: number;
boxSizing: string;
}
export declare function calculateNodeStyling(node: HTMLElement, useCache?: boolean): NodeType;
export default function calculateAutoSizeStyle(uiTextNode: HTMLTextAreaElement, useCache?: boolean, minRows?: number | null, maxRows?: number | null): React.CSSProperties;

114
node_modules/rc-textarea/es/calculateNodeHeight.js generated vendored Normal file
View File

@@ -0,0 +1,114 @@
// Thanks to https://github.com/andreypopp/react-textarea-autosize/
/**
* calculateNodeHeight(uiTextNode, useCache = false)
*/
var HIDDEN_TEXTAREA_STYLE = "\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important;\n pointer-events: none !important;\n";
var SIZING_STYLE = ['letter-spacing', 'line-height', 'padding-top', 'padding-bottom', 'font-family', 'font-weight', 'font-size', 'font-variant', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-left', 'padding-right', 'border-width', 'box-sizing', 'word-break', 'white-space'];
var computedStyleCache = {};
var hiddenTextarea;
export function calculateNodeStyling(node) {
var useCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var nodeRef = node.getAttribute('id') || node.getAttribute('data-reactid') || node.getAttribute('name');
if (useCache && computedStyleCache[nodeRef]) {
return computedStyleCache[nodeRef];
}
var style = window.getComputedStyle(node);
var boxSizing = style.getPropertyValue('box-sizing') || style.getPropertyValue('-moz-box-sizing') || style.getPropertyValue('-webkit-box-sizing');
var paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top'));
var borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width'));
var sizingStyle = SIZING_STYLE.map(function (name) {
return "".concat(name, ":").concat(style.getPropertyValue(name));
}).join(';');
var nodeInfo = {
sizingStyle: sizingStyle,
paddingSize: paddingSize,
borderSize: borderSize,
boxSizing: boxSizing
};
if (useCache && nodeRef) {
computedStyleCache[nodeRef] = nodeInfo;
}
return nodeInfo;
}
export default function calculateAutoSizeStyle(uiTextNode) {
var useCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var minRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var maxRows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
if (!hiddenTextarea) {
hiddenTextarea = document.createElement('textarea');
hiddenTextarea.setAttribute('tab-index', '-1');
hiddenTextarea.setAttribute('aria-hidden', 'true');
// fix: A form field element should have an id or name attribute
// A form field element has neither an id nor a name attribute. This might prevent the browser from correctly autofilling the form.
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
hiddenTextarea.setAttribute('name', 'hiddenTextarea');
document.body.appendChild(hiddenTextarea);
}
// Fix wrap="off" issue
// https://github.com/ant-design/ant-design/issues/6577
if (uiTextNode.getAttribute('wrap')) {
hiddenTextarea.setAttribute('wrap', uiTextNode.getAttribute('wrap'));
} else {
hiddenTextarea.removeAttribute('wrap');
}
// Copy all CSS properties that have an impact on the height of the content in
// the textbox
var _calculateNodeStyling = calculateNodeStyling(uiTextNode, useCache),
paddingSize = _calculateNodeStyling.paddingSize,
borderSize = _calculateNodeStyling.borderSize,
boxSizing = _calculateNodeStyling.boxSizing,
sizingStyle = _calculateNodeStyling.sizingStyle;
// Need to have the overflow attribute to hide the scrollbar otherwise
// text-lines will not calculated properly as the shadow will technically be
// narrower for content
hiddenTextarea.setAttribute('style', "".concat(sizingStyle, ";").concat(HIDDEN_TEXTAREA_STYLE));
hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || '';
var minHeight = undefined;
var maxHeight = undefined;
var overflowY;
var height = hiddenTextarea.scrollHeight;
if (boxSizing === 'border-box') {
// border-box: add border, since height = content + padding + border
height += borderSize;
} else if (boxSizing === 'content-box') {
// remove padding, since height = content
height -= paddingSize;
}
if (minRows !== null || maxRows !== null) {
// measure height of a textarea with a single row
hiddenTextarea.value = ' ';
var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
if (minRows !== null) {
minHeight = singleRowHeight * minRows;
if (boxSizing === 'border-box') {
minHeight = minHeight + paddingSize + borderSize;
}
height = Math.max(minHeight, height);
}
if (maxRows !== null) {
maxHeight = singleRowHeight * maxRows;
if (boxSizing === 'border-box') {
maxHeight = maxHeight + paddingSize + borderSize;
}
overflowY = height > maxHeight ? '' : 'hidden';
height = Math.min(maxHeight, height);
}
}
var style = {
height: height,
overflowY: overflowY,
resize: 'none'
};
if (minHeight) {
style.minHeight = minHeight;
}
if (maxHeight) {
style.maxHeight = maxHeight;
}
return style;
}

4
node_modules/rc-textarea/es/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import TextArea from './TextArea';
export { default as ResizableTextArea } from './ResizableTextArea';
export type { AutoSizeType, ResizableTextAreaRef, TextAreaProps, TextAreaRef, } from './interface';
export default TextArea;

3
node_modules/rc-textarea/es/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import TextArea from "./TextArea";
export { default as ResizableTextArea } from "./ResizableTextArea";
export default TextArea;

37
node_modules/rc-textarea/es/interface.d.ts generated vendored Normal file
View File

@@ -0,0 +1,37 @@
import type { BaseInputProps, CommonInputProps, InputProps } from 'rc-input/lib/interface';
import type React from 'react';
import type { CSSProperties } from 'react';
export interface AutoSizeType {
minRows?: number;
maxRows?: number;
}
export interface ResizableTextAreaRef {
textArea: HTMLTextAreaElement;
}
export type HTMLTextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
export type TextAreaProps = Omit<HTMLTextareaProps, 'onResize' | 'value'> & {
value?: HTMLTextareaProps['value'] | bigint;
prefixCls?: string;
className?: string;
style?: React.CSSProperties;
autoSize?: boolean | AutoSizeType;
onPressEnter?: React.KeyboardEventHandler<HTMLTextAreaElement>;
onResize?: (size: {
width: number;
height: number;
}) => void;
classNames?: CommonInputProps['classNames'] & {
textarea?: string;
count?: string;
};
styles?: {
textarea?: CSSProperties;
count?: CSSProperties;
};
} & Pick<BaseInputProps, 'allowClear' | 'suffix'> & Pick<InputProps, 'showCount' | 'count' | 'onClear'>;
export type TextAreaRef = {
resizableTextArea: ResizableTextAreaRef;
focus: () => void;
blur: () => void;
nativeElement: HTMLElement;
};

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

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

30
node_modules/rc-textarea/lib/ResizableTextArea.d.ts generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import * as React from 'react';
import type { ResizableTextAreaRef } from './interface';
declare const ResizableTextArea: React.ForwardRefExoticComponent<Omit<import("./interface").HTMLTextareaProps, "value" | "onResize"> & {
value?: string | number | bigint | readonly string[];
prefixCls?: string;
className?: string;
style?: React.CSSProperties;
autoSize?: boolean | import("./interface").AutoSizeType;
onPressEnter?: React.KeyboardEventHandler<HTMLTextAreaElement>;
onResize?: (size: {
width: number;
height: number;
}) => void;
classNames?: {
affixWrapper?: string;
prefix?: string;
suffix?: string;
groupWrapper?: string;
wrapper?: string;
variant?: string;
} & {
textarea?: string;
count?: string;
};
styles?: {
textarea?: React.CSSProperties;
count?: React.CSSProperties;
};
} & Pick<import("rc-input/lib/interface").BaseInputProps, "allowClear" | "suffix"> & Pick<import("rc-input").InputProps, "showCount" | "count" | "onClear"> & React.RefAttributes<ResizableTextAreaRef>>;
export default ResizableTextArea;

164
node_modules/rc-textarea/lib/ResizableTextArea.js generated vendored Normal file
View File

@@ -0,0 +1,164 @@
"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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _classnames = _interopRequireDefault(require("classnames"));
var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer"));
var _useLayoutEffect = _interopRequireDefault(require("rc-util/lib/hooks/useLayoutEffect"));
var _useMergedState3 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
var _raf = _interopRequireDefault(require("rc-util/lib/raf"));
var React = _interopRequireWildcard(require("react"));
var _calculateNodeHeight = _interopRequireDefault(require("./calculateNodeHeight"));
var _excluded = ["prefixCls", "defaultValue", "value", "autoSize", "onResize", "className", "style", "disabled", "onChange", "onInternalAutoSize"];
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 RESIZE_START = 0;
var RESIZE_MEASURING = 1;
var RESIZE_STABLE = 2;
var ResizableTextArea = /*#__PURE__*/React.forwardRef(function (props, ref) {
var _ref = props,
prefixCls = _ref.prefixCls,
defaultValue = _ref.defaultValue,
value = _ref.value,
autoSize = _ref.autoSize,
onResize = _ref.onResize,
className = _ref.className,
style = _ref.style,
disabled = _ref.disabled,
onChange = _ref.onChange,
onInternalAutoSize = _ref.onInternalAutoSize,
restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
// =============================== Value ================================
var _useMergedState = (0, _useMergedState3.default)(defaultValue, {
value: value,
postState: function postState(val) {
return val !== null && val !== void 0 ? val : '';
}
}),
_useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2),
mergedValue = _useMergedState2[0],
setMergedValue = _useMergedState2[1];
var onInternalChange = function onInternalChange(event) {
setMergedValue(event.target.value);
onChange === null || onChange === void 0 || onChange(event);
};
// ================================ Ref =================================
var textareaRef = React.useRef();
React.useImperativeHandle(ref, function () {
return {
textArea: textareaRef.current
};
});
// ============================== AutoSize ==============================
var _React$useMemo = React.useMemo(function () {
if (autoSize && (0, _typeof2.default)(autoSize) === 'object') {
return [autoSize.minRows, autoSize.maxRows];
}
return [];
}, [autoSize]),
_React$useMemo2 = (0, _slicedToArray2.default)(_React$useMemo, 2),
minRows = _React$useMemo2[0],
maxRows = _React$useMemo2[1];
var needAutoSize = !!autoSize;
// =============================== Resize ===============================
var _React$useState = React.useState(RESIZE_STABLE),
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
resizeState = _React$useState2[0],
setResizeState = _React$useState2[1];
var _React$useState3 = React.useState(),
_React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
autoSizeStyle = _React$useState4[0],
setAutoSizeStyle = _React$useState4[1];
var startResize = function startResize() {
setResizeState(RESIZE_START);
if (process.env.NODE_ENV === 'test') {
onInternalAutoSize === null || onInternalAutoSize === void 0 || onInternalAutoSize();
}
};
// Change to trigger resize measure
(0, _useLayoutEffect.default)(function () {
if (needAutoSize) {
startResize();
}
}, [value, minRows, maxRows, needAutoSize]);
(0, _useLayoutEffect.default)(function () {
if (resizeState === RESIZE_START) {
setResizeState(RESIZE_MEASURING);
} else if (resizeState === RESIZE_MEASURING) {
var textareaStyles = (0, _calculateNodeHeight.default)(textareaRef.current, false, minRows, maxRows);
// Safari has bug that text will keep break line on text cut when it's prev is break line.
// ZombieJ: This not often happen. So we just skip it.
// const { selectionStart, selectionEnd, scrollTop } = textareaRef.current;
// const { value: tmpValue } = textareaRef.current;
// textareaRef.current.value = '';
// textareaRef.current.value = tmpValue;
// if (document.activeElement === textareaRef.current) {
// textareaRef.current.scrollTop = scrollTop;
// textareaRef.current.setSelectionRange(selectionStart, selectionEnd);
// }
setResizeState(RESIZE_STABLE);
setAutoSizeStyle(textareaStyles);
} else {
// https://github.com/react-component/textarea/pull/23
// Firefox has blink issue before but fixed in latest version.
}
}, [resizeState]);
// We lock resize trigger by raf to avoid Safari warning
var resizeRafRef = React.useRef();
var cleanRaf = function cleanRaf() {
_raf.default.cancel(resizeRafRef.current);
};
var onInternalResize = function onInternalResize(size) {
if (resizeState === RESIZE_STABLE) {
onResize === null || onResize === void 0 || onResize(size);
if (autoSize) {
cleanRaf();
resizeRafRef.current = (0, _raf.default)(function () {
startResize();
});
}
}
};
React.useEffect(function () {
return cleanRaf;
}, []);
// =============================== Render ===============================
var mergedAutoSizeStyle = needAutoSize ? autoSizeStyle : null;
var mergedStyle = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, style), mergedAutoSizeStyle);
if (resizeState === RESIZE_START || resizeState === RESIZE_MEASURING) {
mergedStyle.overflowY = 'hidden';
mergedStyle.overflowX = 'hidden';
}
return /*#__PURE__*/React.createElement(_rcResizeObserver.default, {
onResize: onInternalResize,
disabled: !(autoSize || onResize)
}, /*#__PURE__*/React.createElement("textarea", (0, _extends2.default)({}, restProps, {
ref: textareaRef,
style: mergedStyle,
className: (0, _classnames.default)(prefixCls, className, (0, _defineProperty2.default)({}, "".concat(prefixCls, "-disabled"), disabled)),
disabled: disabled,
value: mergedValue,
onChange: onInternalChange
})));
});
var _default = exports.default = ResizableTextArea;

30
node_modules/rc-textarea/lib/TextArea.d.ts generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import React from 'react';
import type { TextAreaRef } from './interface';
declare const TextArea: React.ForwardRefExoticComponent<Omit<import("./interface").HTMLTextareaProps, "value" | "onResize"> & {
value?: string | number | bigint | readonly string[];
prefixCls?: string;
className?: string;
style?: React.CSSProperties;
autoSize?: boolean | import("./interface").AutoSizeType;
onPressEnter?: React.KeyboardEventHandler<HTMLTextAreaElement>;
onResize?: (size: {
width: number;
height: number;
}) => void;
classNames?: {
affixWrapper?: string;
prefix?: string;
suffix?: string;
groupWrapper?: string;
wrapper?: string;
variant?: string;
} & {
textarea?: string;
count?: string;
};
styles?: {
textarea?: React.CSSProperties;
count?: React.CSSProperties;
};
} & Pick<import("rc-input/lib/interface").BaseInputProps, "allowClear" | "suffix"> & Pick<import("rc-input").InputProps, "showCount" | "count" | "onClear"> & React.RefAttributes<TextAreaRef>>;
export default TextArea;

238
node_modules/rc-textarea/lib/TextArea.js generated vendored Normal file
View File

@@ -0,0 +1,238 @@
"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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
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 _rcInput = require("rc-input");
var _useCount = _interopRequireDefault(require("rc-input/lib/hooks/useCount"));
var _commonUtils = require("rc-input/lib/utils/commonUtils");
var _useMergedState3 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
var _react = _interopRequireWildcard(require("react"));
var _ResizableTextArea = _interopRequireDefault(require("./ResizableTextArea"));
var _excluded = ["defaultValue", "value", "onFocus", "onBlur", "onChange", "allowClear", "maxLength", "onCompositionStart", "onCompositionEnd", "suffix", "prefixCls", "showCount", "count", "className", "style", "disabled", "hidden", "classNames", "styles", "onResize", "onClear", "onPressEnter", "readOnly", "autoSize", "onKeyDown"];
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 TextArea = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
var _countConfig$max;
var defaultValue = _ref.defaultValue,
customValue = _ref.value,
onFocus = _ref.onFocus,
onBlur = _ref.onBlur,
onChange = _ref.onChange,
allowClear = _ref.allowClear,
maxLength = _ref.maxLength,
onCompositionStart = _ref.onCompositionStart,
onCompositionEnd = _ref.onCompositionEnd,
suffix = _ref.suffix,
_ref$prefixCls = _ref.prefixCls,
prefixCls = _ref$prefixCls === void 0 ? 'rc-textarea' : _ref$prefixCls,
showCount = _ref.showCount,
count = _ref.count,
className = _ref.className,
style = _ref.style,
disabled = _ref.disabled,
hidden = _ref.hidden,
classNames = _ref.classNames,
styles = _ref.styles,
onResize = _ref.onResize,
onClear = _ref.onClear,
onPressEnter = _ref.onPressEnter,
readOnly = _ref.readOnly,
autoSize = _ref.autoSize,
onKeyDown = _ref.onKeyDown,
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
var _useMergedState = (0, _useMergedState3.default)(defaultValue, {
value: customValue,
defaultValue: defaultValue
}),
_useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2),
value = _useMergedState2[0],
setValue = _useMergedState2[1];
var formatValue = value === undefined || value === null ? '' : String(value);
var _React$useState = _react.default.useState(false),
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
focused = _React$useState2[0],
setFocused = _React$useState2[1];
var compositionRef = _react.default.useRef(false);
var _React$useState3 = _react.default.useState(null),
_React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
textareaResized = _React$useState4[0],
setTextareaResized = _React$useState4[1];
// =============================== Ref ================================
var holderRef = (0, _react.useRef)(null);
var resizableTextAreaRef = (0, _react.useRef)(null);
var getTextArea = function getTextArea() {
var _resizableTextAreaRef;
return (_resizableTextAreaRef = resizableTextAreaRef.current) === null || _resizableTextAreaRef === void 0 ? void 0 : _resizableTextAreaRef.textArea;
};
var focus = function focus() {
getTextArea().focus();
};
(0, _react.useImperativeHandle)(ref, function () {
var _holderRef$current;
return {
resizableTextArea: resizableTextAreaRef.current,
focus: focus,
blur: function blur() {
getTextArea().blur();
},
nativeElement: ((_holderRef$current = holderRef.current) === null || _holderRef$current === void 0 ? void 0 : _holderRef$current.nativeElement) || getTextArea()
};
});
(0, _react.useEffect)(function () {
setFocused(function (prev) {
return !disabled && prev;
});
}, [disabled]);
// =========================== Select Range ===========================
var _React$useState5 = _react.default.useState(null),
_React$useState6 = (0, _slicedToArray2.default)(_React$useState5, 2),
selection = _React$useState6[0],
setSelection = _React$useState6[1];
_react.default.useEffect(function () {
if (selection) {
var _getTextArea;
(_getTextArea = getTextArea()).setSelectionRange.apply(_getTextArea, (0, _toConsumableArray2.default)(selection));
}
}, [selection]);
// ============================== Count ===============================
var countConfig = (0, _useCount.default)(count, showCount);
var mergedMax = (_countConfig$max = countConfig.max) !== null && _countConfig$max !== void 0 ? _countConfig$max : maxLength;
// Max length value
var hasMaxLength = Number(mergedMax) > 0;
var valueLength = countConfig.strategy(formatValue);
var isOutOfRange = !!mergedMax && valueLength > mergedMax;
// ============================== Change ==============================
var triggerChange = function triggerChange(e, currentValue) {
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) {
setSelection([getTextArea().selectionStart || 0, getTextArea().selectionEnd || 0]);
}
}
setValue(cutValue);
(0, _commonUtils.resolveOnChange)(e.currentTarget, e, onChange, cutValue);
};
// =========================== Value Update ===========================
var onInternalCompositionStart = function onInternalCompositionStart(e) {
compositionRef.current = true;
onCompositionStart === null || onCompositionStart === void 0 || onCompositionStart(e);
};
var onInternalCompositionEnd = function onInternalCompositionEnd(e) {
compositionRef.current = false;
triggerChange(e, e.currentTarget.value);
onCompositionEnd === null || onCompositionEnd === void 0 || onCompositionEnd(e);
};
var onInternalChange = function onInternalChange(e) {
triggerChange(e, e.target.value);
};
var handleKeyDown = function handleKeyDown(e) {
if (e.key === 'Enter' && onPressEnter) {
onPressEnter(e);
}
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
};
var handleFocus = function handleFocus(e) {
setFocused(true);
onFocus === null || onFocus === void 0 || onFocus(e);
};
var handleBlur = function handleBlur(e) {
setFocused(false);
onBlur === null || onBlur === void 0 || onBlur(e);
};
// ============================== Reset ===============================
var handleReset = function handleReset(e) {
setValue('');
focus();
(0, _commonUtils.resolveOnChange)(getTextArea(), e, onChange);
};
var suffixNode = suffix;
var dataCount;
if (countConfig.show) {
if (countConfig.showFormatter) {
dataCount = countConfig.showFormatter({
value: formatValue,
count: valueLength,
maxLength: mergedMax
});
} else {
dataCount = "".concat(valueLength).concat(hasMaxLength ? " / ".concat(mergedMax) : '');
}
suffixNode = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, suffixNode, /*#__PURE__*/_react.default.createElement("span", {
className: (0, _classnames.default)("".concat(prefixCls, "-data-count"), classNames === null || classNames === void 0 ? void 0 : classNames.count),
style: styles === null || styles === void 0 ? void 0 : styles.count
}, dataCount));
}
var handleResize = function handleResize(size) {
var _getTextArea2;
onResize === null || onResize === void 0 || onResize(size);
if ((_getTextArea2 = getTextArea()) !== null && _getTextArea2 !== void 0 && _getTextArea2.style.height) {
setTextareaResized(true);
}
};
var isPureTextArea = !autoSize && !showCount && !allowClear;
return /*#__PURE__*/_react.default.createElement(_rcInput.BaseInput, {
ref: holderRef,
value: formatValue,
allowClear: allowClear,
handleReset: handleReset,
suffix: suffixNode,
prefixCls: prefixCls,
classNames: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, classNames), {}, {
affixWrapper: (0, _classnames.default)(classNames === null || classNames === void 0 ? void 0 : classNames.affixWrapper, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(prefixCls, "-show-count"), showCount), "".concat(prefixCls, "-textarea-allow-clear"), allowClear))
}),
disabled: disabled,
focused: focused,
className: (0, _classnames.default)(className, isOutOfRange && "".concat(prefixCls, "-out-of-range")),
style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, style), textareaResized && !isPureTextArea ? {
height: 'auto'
} : {}),
dataAttrs: {
affixWrapper: {
'data-count': typeof dataCount === 'string' ? dataCount : undefined
}
},
hidden: hidden,
readOnly: readOnly,
onClear: onClear
}, /*#__PURE__*/_react.default.createElement(_ResizableTextArea.default, (0, _extends2.default)({}, rest, {
autoSize: autoSize,
maxLength: maxLength,
onKeyDown: handleKeyDown,
onChange: onInternalChange,
onFocus: handleFocus,
onBlur: handleBlur,
onCompositionStart: onInternalCompositionStart,
onCompositionEnd: onInternalCompositionEnd,
className: (0, _classnames.default)(classNames === null || classNames === void 0 ? void 0 : classNames.textarea),
style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, styles === null || styles === void 0 ? void 0 : styles.textarea), {}, {
resize: style === null || style === void 0 ? void 0 : style.resize
}),
disabled: disabled,
prefixCls: prefixCls,
onResize: handleResize,
ref: resizableTextAreaRef,
readOnly: readOnly
})));
});
var _default = exports.default = TextArea;

View File

@@ -0,0 +1,9 @@
import type React from 'react';
export interface NodeType {
sizingStyle: string;
paddingSize: number;
borderSize: number;
boxSizing: string;
}
export declare function calculateNodeStyling(node: HTMLElement, useCache?: boolean): NodeType;
export default function calculateAutoSizeStyle(uiTextNode: HTMLTextAreaElement, useCache?: boolean, minRows?: number | null, maxRows?: number | null): React.CSSProperties;

121
node_modules/rc-textarea/lib/calculateNodeHeight.js generated vendored Normal file
View File

@@ -0,0 +1,121 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.calculateNodeStyling = calculateNodeStyling;
exports.default = calculateAutoSizeStyle;
// Thanks to https://github.com/andreypopp/react-textarea-autosize/
/**
* calculateNodeHeight(uiTextNode, useCache = false)
*/
var HIDDEN_TEXTAREA_STYLE = "\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important;\n pointer-events: none !important;\n";
var SIZING_STYLE = ['letter-spacing', 'line-height', 'padding-top', 'padding-bottom', 'font-family', 'font-weight', 'font-size', 'font-variant', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-left', 'padding-right', 'border-width', 'box-sizing', 'word-break', 'white-space'];
var computedStyleCache = {};
var hiddenTextarea;
function calculateNodeStyling(node) {
var useCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var nodeRef = node.getAttribute('id') || node.getAttribute('data-reactid') || node.getAttribute('name');
if (useCache && computedStyleCache[nodeRef]) {
return computedStyleCache[nodeRef];
}
var style = window.getComputedStyle(node);
var boxSizing = style.getPropertyValue('box-sizing') || style.getPropertyValue('-moz-box-sizing') || style.getPropertyValue('-webkit-box-sizing');
var paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top'));
var borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width'));
var sizingStyle = SIZING_STYLE.map(function (name) {
return "".concat(name, ":").concat(style.getPropertyValue(name));
}).join(';');
var nodeInfo = {
sizingStyle: sizingStyle,
paddingSize: paddingSize,
borderSize: borderSize,
boxSizing: boxSizing
};
if (useCache && nodeRef) {
computedStyleCache[nodeRef] = nodeInfo;
}
return nodeInfo;
}
function calculateAutoSizeStyle(uiTextNode) {
var useCache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var minRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var maxRows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
if (!hiddenTextarea) {
hiddenTextarea = document.createElement('textarea');
hiddenTextarea.setAttribute('tab-index', '-1');
hiddenTextarea.setAttribute('aria-hidden', 'true');
// fix: A form field element should have an id or name attribute
// A form field element has neither an id nor a name attribute. This might prevent the browser from correctly autofilling the form.
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
hiddenTextarea.setAttribute('name', 'hiddenTextarea');
document.body.appendChild(hiddenTextarea);
}
// Fix wrap="off" issue
// https://github.com/ant-design/ant-design/issues/6577
if (uiTextNode.getAttribute('wrap')) {
hiddenTextarea.setAttribute('wrap', uiTextNode.getAttribute('wrap'));
} else {
hiddenTextarea.removeAttribute('wrap');
}
// Copy all CSS properties that have an impact on the height of the content in
// the textbox
var _calculateNodeStyling = calculateNodeStyling(uiTextNode, useCache),
paddingSize = _calculateNodeStyling.paddingSize,
borderSize = _calculateNodeStyling.borderSize,
boxSizing = _calculateNodeStyling.boxSizing,
sizingStyle = _calculateNodeStyling.sizingStyle;
// Need to have the overflow attribute to hide the scrollbar otherwise
// text-lines will not calculated properly as the shadow will technically be
// narrower for content
hiddenTextarea.setAttribute('style', "".concat(sizingStyle, ";").concat(HIDDEN_TEXTAREA_STYLE));
hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || '';
var minHeight = undefined;
var maxHeight = undefined;
var overflowY;
var height = hiddenTextarea.scrollHeight;
if (boxSizing === 'border-box') {
// border-box: add border, since height = content + padding + border
height += borderSize;
} else if (boxSizing === 'content-box') {
// remove padding, since height = content
height -= paddingSize;
}
if (minRows !== null || maxRows !== null) {
// measure height of a textarea with a single row
hiddenTextarea.value = ' ';
var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
if (minRows !== null) {
minHeight = singleRowHeight * minRows;
if (boxSizing === 'border-box') {
minHeight = minHeight + paddingSize + borderSize;
}
height = Math.max(minHeight, height);
}
if (maxRows !== null) {
maxHeight = singleRowHeight * maxRows;
if (boxSizing === 'border-box') {
maxHeight = maxHeight + paddingSize + borderSize;
}
overflowY = height > maxHeight ? '' : 'hidden';
height = Math.min(maxHeight, height);
}
}
var style = {
height: height,
overflowY: overflowY,
resize: 'none'
};
if (minHeight) {
style.minHeight = minHeight;
}
if (maxHeight) {
style.maxHeight = maxHeight;
}
return style;
}

4
node_modules/rc-textarea/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import TextArea from './TextArea';
export { default as ResizableTextArea } from './ResizableTextArea';
export type { AutoSizeType, ResizableTextAreaRef, TextAreaProps, TextAreaRef, } from './interface';
export default TextArea;

16
node_modules/rc-textarea/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ResizableTextArea", {
enumerable: true,
get: function get() {
return _ResizableTextArea.default;
}
});
exports.default = void 0;
var _TextArea = _interopRequireDefault(require("./TextArea"));
var _ResizableTextArea = _interopRequireDefault(require("./ResizableTextArea"));
var _default = exports.default = _TextArea.default;

37
node_modules/rc-textarea/lib/interface.d.ts generated vendored Normal file
View File

@@ -0,0 +1,37 @@
import type { BaseInputProps, CommonInputProps, InputProps } from 'rc-input/lib/interface';
import type React from 'react';
import type { CSSProperties } from 'react';
export interface AutoSizeType {
minRows?: number;
maxRows?: number;
}
export interface ResizableTextAreaRef {
textArea: HTMLTextAreaElement;
}
export type HTMLTextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
export type TextAreaProps = Omit<HTMLTextareaProps, 'onResize' | 'value'> & {
value?: HTMLTextareaProps['value'] | bigint;
prefixCls?: string;
className?: string;
style?: React.CSSProperties;
autoSize?: boolean | AutoSizeType;
onPressEnter?: React.KeyboardEventHandler<HTMLTextAreaElement>;
onResize?: (size: {
width: number;
height: number;
}) => void;
classNames?: CommonInputProps['classNames'] & {
textarea?: string;
count?: string;
};
styles?: {
textarea?: CSSProperties;
count?: CSSProperties;
};
} & Pick<BaseInputProps, 'allowClear' | 'suffix'> & Pick<InputProps, 'showCount' | 'count' | 'onClear'>;
export type TextAreaRef = {
resizableTextArea: ResizableTextAreaRef;
focus: () => void;
blur: () => void;
nativeElement: HTMLElement;
};

5
node_modules/rc-textarea/lib/interface.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});

85
node_modules/rc-textarea/package.json generated vendored Normal file
View File

@@ -0,0 +1,85 @@
{
"name": "rc-textarea",
"version": "1.10.2",
"description": "Pretty Textarea react component used in used in ant.design",
"keywords": [
"react",
"react-component",
"react-textarea",
"textarea",
"antd",
"ant-design"
],
"main": "./lib/index",
"module": "./es/index",
"files": [
"assets/*.css",
"assets/*.less",
"es",
"lib",
"dist"
],
"homepage": "https://react-component.github.io/textarea",
"repository": {
"type": "git",
"url": "git@github.com:react-component/textarea.git"
},
"bugs": {
"url": "http://github.com/react-component/textarea/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": "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",
"test": "umi-test",
"coverage": "umi-test --coverage"
},
"dependencies": {
"@babel/runtime": "^7.10.1",
"classnames": "^2.2.1",
"rc-input": "~1.8.0",
"rc-resize-observer": "^1.0.0",
"rc-util": "^5.27.0"
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^15.0.0",
"@types/classnames": "^2.2.9",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@umijs/fabric": "^2.0.8",
"coveralls": "^3.0.6",
"cross-env": "^7.0.2",
"dumi": "^2.0.0",
"eslint": "^7.0.0",
"father": "^4.0.0",
"gh-pages": "^3.1.0",
"husky": "^4.2.5",
"less": "^3.10.3",
"np": "^10.2.0",
"prettier": "^2.0.5",
"pretty-quick": "^2.0.1",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"cheerio": "1.0.0-rc.12",
"umi-test": "^1.9.7"
},
"peerDependencies": {
"react": ">=16.9.0",
"react-dom": ">=16.9.0"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
}
}