interface.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import type { BaseInputProps, CommonInputProps, InputProps } from 'rc-input/lib/interface';
  2. import type React from 'react';
  3. import type { CSSProperties } from 'react';
  4. export interface AutoSizeType {
  5. minRows?: number;
  6. maxRows?: number;
  7. }
  8. export interface ResizableTextAreaRef {
  9. textArea: HTMLTextAreaElement;
  10. }
  11. export type HTMLTextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
  12. export type TextAreaProps = Omit<HTMLTextareaProps, 'onResize' | 'value'> & {
  13. value?: HTMLTextareaProps['value'] | bigint;
  14. prefixCls?: string;
  15. className?: string;
  16. style?: React.CSSProperties;
  17. autoSize?: boolean | AutoSizeType;
  18. onPressEnter?: React.KeyboardEventHandler<HTMLTextAreaElement>;
  19. onResize?: (size: {
  20. width: number;
  21. height: number;
  22. }) => void;
  23. classNames?: CommonInputProps['classNames'] & {
  24. textarea?: string;
  25. count?: string;
  26. };
  27. styles?: {
  28. textarea?: CSSProperties;
  29. count?: CSSProperties;
  30. };
  31. } & Pick<BaseInputProps, 'allowClear' | 'suffix'> & Pick<InputProps, 'showCount' | 'count' | 'onClear'>;
  32. export type TextAreaRef = {
  33. resizableTextArea: ResizableTextAreaRef;
  34. focus: () => void;
  35. blur: () => void;
  36. nativeElement: HTMLElement;
  37. };