@@ -10,12 +10,19 @@ import {
1010 filterOption as defaultFilterOption ,
1111 getBeforeSelectionText ,
1212 getLastMeasureIndex ,
13+ omit ,
14+ Omit ,
1315 replaceWithMeasure ,
1416 setInputSelection ,
1517 validateSearch as defaultValidateSearch ,
1618} from './util' ;
1719
18- export interface MentionsProps {
20+ type BaseTextareaAttrs = Omit <
21+ React . TextareaHTMLAttributes < HTMLTextAreaElement > ,
22+ 'prefix' | 'onChange' | 'onSelect'
23+ > ;
24+
25+ export interface MentionsProps extends BaseTextareaAttrs {
1926 defaultValue ?: string ;
2027 value ?: string ;
2128 onChange ?: ( text : string ) => void ;
@@ -32,7 +39,6 @@ export interface MentionsProps {
3239 validateSearch ?: typeof defaultValidateSearch ;
3340 filterOption ?: false | typeof defaultFilterOption ;
3441 notFoundContent ?: React . ReactNode ;
35- rows ?: number ;
3642}
3743interface MentionsState {
3844 value : string ;
@@ -311,7 +317,9 @@ class Mentions extends React.Component<MentionsProps, MentionsState> {
311317
312318 public render ( ) {
313319 const { value, measureLocation, measurePrefix, measuring, activeIndex } = this . state ;
314- const { prefixCls, className, style, autoFocus, notFoundContent, rows } = this . props ;
320+ const { prefixCls, className, style, autoFocus, notFoundContent, ...restProps } = this . props ;
321+
322+ const inputProps = omit ( restProps , 'prefix' , 'onSelect' ) ;
315323
316324 const options = measuring ? this . getOptions ( ) : [ ] ;
317325
@@ -321,7 +329,7 @@ class Mentions extends React.Component<MentionsProps, MentionsState> {
321329 autoFocus = { autoFocus }
322330 ref = { this . setTextAreaRef }
323331 value = { value }
324- rows = { rows }
332+ { ... inputProps }
325333 onChange = { this . onChange }
326334 onKeyDown = { this . onKeyDown }
327335 onKeyUp = { this . onKeyUp }
0 commit comments