(
e:
| React.ChangeEvent<HTMLInputElement>
| React.CompositionEvent<HTMLInputElement>,
currentValue: string,
info: ChangeEventInfo,
)
| 101 | }, [disabled]); |
| 102 | |
| 103 | const triggerChange = ( |
| 104 | e: |
| 105 | | React.ChangeEvent<HTMLInputElement> |
| 106 | | React.CompositionEvent<HTMLInputElement>, |
| 107 | currentValue: string, |
| 108 | info: ChangeEventInfo, |
| 109 | ) => { |
| 110 | let cutValue = currentValue; |
| 111 | |
| 112 | if ( |
| 113 | !compositionRef.current && |
| 114 | countConfig.exceedFormatter && |
| 115 | countConfig.max && |
| 116 | countConfig.strategy(currentValue) > countConfig.max |
| 117 | ) { |
| 118 | cutValue = countConfig.exceedFormatter(currentValue, { |
| 119 | max: countConfig.max, |
| 120 | }); |
| 121 | |
| 122 | if (currentValue !== cutValue) { |
| 123 | setSelection([ |
| 124 | inputRef.current?.selectionStart || 0, |
| 125 | inputRef.current?.selectionEnd || 0, |
| 126 | ]); |
| 127 | } |
| 128 | } else if (info.source === 'compositionEnd') { |
| 129 | // Avoid triggering twice |
| 130 | // https://github.com/ant-design/ant-design/issues/46587 |
| 131 | return; |
| 132 | } |
| 133 | setValue(cutValue); |
| 134 | |
| 135 | if (inputRef.current) { |
| 136 | resolveOnChange(inputRef.current, e, onChange, cutValue); |
| 137 | } |
| 138 | }; |
| 139 | |
| 140 | useEffect(() => { |
| 141 | if (selection) { |
no test coverage detected
searching dependent graphs…