diff --git a/components/input/TextArea.tsx b/components/input/TextArea.tsx index 21a44e6dbd7a..fc492694f992 100644 --- a/components/input/TextArea.tsx +++ b/components/input/TextArea.tsx @@ -1,17 +1,18 @@ +import * as React from 'react'; +import { forwardRef } from 'react'; import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled'; import classNames from 'classnames'; import type { BaseInputProps } from 'rc-input/lib/interface'; import type { TextAreaRef as RcTextAreaRef } from 'rc-textarea'; import RcTextArea from 'rc-textarea'; import type { TextAreaProps as RcTextAreaProps } from 'rc-textarea/lib/interface'; -import * as React from 'react'; -import { forwardRef } from 'react'; + import type { InputStatus } from '../_util/statusUtils'; import { getMergedStatus, getStatusClassNames } from '../_util/statusUtils'; import { ConfigContext } from '../config-provider'; import DisabledContext from '../config-provider/DisabledContext'; -import type { SizeType } from '../config-provider/SizeContext'; import useSize from '../config-provider/hooks/useSize'; +import type { SizeType } from '../config-provider/SizeContext'; import { FormItemInputContext } from '../form/context'; import type { InputFocusOptions } from './Input'; import { triggerFocus } from './Input'; @@ -38,7 +39,6 @@ const TextArea = forwardRef((props, ref) => { disabled: customDisabled, status: customStatus, allowClear, - showCount, classNames: classes, rootClassName, className, @@ -99,7 +99,7 @@ const TextArea = forwardRef((props, ref) => { [`${prefixCls}-affix-wrapper-borderless`]: !bordered, [`${prefixCls}-affix-wrapper-sm`]: mergedSize === 'small', [`${prefixCls}-affix-wrapper-lg`]: mergedSize === 'large', - [`${prefixCls}-textarea-show-count`]: showCount, + [`${prefixCls}-textarea-show-count`]: props.showCount || props.count?.show, }, getStatusClassNames(`${prefixCls}-affix-wrapper`, mergedStatus), hashId, @@ -120,7 +120,6 @@ const TextArea = forwardRef((props, ref) => { }} prefixCls={prefixCls} suffix={hasFeedback && {feedbackIcon}} - showCount={showCount} ref={innerRef} />, ); diff --git a/components/input/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/input/__tests__/__snapshots__/demo-extend.test.ts.snap index b379db342c08..cc7a19e956e8 100644 --- a/components/input/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/input/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -602,6 +602,91 @@ exports[`renders components/input/demo/addon.tsx extend context correctly 1`] = exports[`renders components/input/demo/addon.tsx extend context correctly 2`] = `[]`; +exports[`renders components/input/demo/advance-count.tsx extend context correctly 1`] = ` +
+
+
+ Exceed Max +
+ + + + + 12 / 10 + + + +
+
+
+ Emoji count as length 1 +
+ + + + + 3 + + + +
+
+
+ Not exceed max +
+ + + + + 6 / 6 + + + +
+
+`; + +exports[`renders components/input/demo/advance-count.tsx extend context correctly 2`] = `[]`; + exports[`renders components/input/demo/align.tsx extend context correctly 1`] = ` Array [
@@ -10366,15 +10454,14 @@ Array [ 0 / 20 - , -
, -
, +