Skip to content

Commit 16ee870

Browse files
authored
Merge pull request #2062 from hqwcxy/master
[FIX] <pro>Table: Fixed the issue where pressing Enter could not move…
2 parents fef061e + 7f34b36 commit 16ee870

4 files changed

Lines changed: 12 additions & 1 deletion

File tree

CHANGELOG.en-US.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ timeline: true
8686
- 🐞 `<pro>Tooltip`: Fixed the issue where the pop-up window did not disappear after the `dom` was removed from the `DOM` tree.
8787
- 🐞 `<pro>Table`: Fixed the issue where pressing Enter from the second page onwards could not move to the next line for editing.
8888
- 🐞 `<pro>Table`: Fixed the issue of row numbers being incorrect in data grouping mode and cells misaligning after deleting data.
89+
- 🐞 `<pro>Table`: Fixed the issue where pressing Enter could not move to the next line when the cell editor was set as a IntlField.
8990
- 🐞 `<pro>Button`: Fixed the issue where text overflow ellipsis style would fail when disabled.
9091

9192
## 1.6.7

CHANGELOG.zh-CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ timeline: true
8686
- 🐞 `<pro>Tooltip`: 修复触发 dom 从 DOM 树中移除后, 弹窗不消失的问题。
8787
- 🐞 `<pro>Table`: 修复从第二页起无法通过回车跳转到下一行编辑的问题。
8888
- 🐞 `<pro>Table`: 修复数据分组模式下行号错乱,删除数据后单元格错位的问题。
89+
- 🐞 `<pro>Table`: 修复编辑器为多语言输入框时,无法通过回车跳转到下一行。
8990
- 🐞 `<pro>Button`: 修复禁用状态下文字溢出省略的样式失效的问题。
9091

9192
## 1.6.7

components-pro/intl-field/IntlField.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export interface IntlFieldProps extends TextAreaProps {
3838
export default class IntlField extends TextArea<IntlFieldProps> {
3939
static displayName = 'IntlField';
4040

41+
static __PRO_INTLFIELD = true;
42+
4143
static defaultProps = {
4244
...TextArea.defaultProps,
4345
rows: 3,

components-pro/table/TableEditor.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { ShowHelp } from '../field/enum';
2727
import autobind from '../_util/autobind';
2828
import { TextAreaProps } from '../text-area/TextArea';
2929
import { ResizeType } from '../text-area/enum';
30+
import { IntlType } from '../intl-field/enum';
3031
import { ColumnLock } from './enum';
3132
import transform from '../_util/transform';
3233
import { LabelLayout, ShowValidation } from '../form/enum';
@@ -39,6 +40,10 @@ function isTextArea(editor: ReactElement<FormFieldProps>): editor is ReactElemen
3940
return (editor.type as any).__PRO_TEXTAREA;
4041
}
4142

43+
function isIntlField(editor: ReactElement<FormFieldProps>): boolean {
44+
return (editor.type as any).__PRO_INTLFIELD;
45+
}
46+
4247
function isHTMLElement(el): el is HTMLElement {
4348
return el;
4449
}
@@ -553,6 +558,8 @@ export default class TableEditor extends Component<TableEditorProps> {
553558
if (height !== undefined) {
554559
style.height = pxToRem(height, true);
555560
}
561+
const isMultipleLineIntlField = isIntlField(cellEditor) && this.editorProps.type === IntlType.multipleLine;
562+
const isTextAreaEditor = isTextArea(cellEditor) && (!isIntlField(cellEditor) || isMultipleLineIntlField);
556563
const newEditorProps = {
557564
...otherProps,
558565
style,
@@ -561,7 +568,7 @@ export default class TableEditor extends Component<TableEditorProps> {
561568
name,
562569
tagRenderer,
563570
onKeyDown: this.handleEditorKeyDown,
564-
onEnterDown: isTextArea(cellEditor) ? undefined : this.handleEditorKeyEnterDown,
571+
onEnterDown: isTextAreaEditor ? undefined : this.handleEditorKeyEnterDown,
565572
onBlur: this.handleEditorBlur,
566573
tabIndex: currentEditorName ? 0 : -1,
567574
showHelp: ShowHelp.none,

0 commit comments

Comments
 (0)