mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-06-12 09:29:43 +08:00
🐛 fix(data-grid): 修复单元格编辑自动首字母大写
- 编辑修复:普通内联单元格编辑输入框增加 noAutoCapInputProps - 虚拟表格:同步为虚拟行内编辑输入框关闭自动大写 - 输入体验:禁用 autoCapitalize、autoCorrect 和 spellCheck,避免 true 被提示为 True - 回归测试:新增 DataGrid 布局断言,覆盖两个内联编辑入口
This commit is contained in:
@@ -433,6 +433,15 @@ describe('DataGrid layout', () => {
|
||||
expect(source).toContain('.${gridId} .data-grid-inline-editor-input');
|
||||
});
|
||||
|
||||
it('disables browser autocapitalization for inline cell editors', () => {
|
||||
const source = readFileSync(new URL('./DataGrid.tsx', import.meta.url), 'utf8');
|
||||
|
||||
const editorInputCount = source.match(/\{\.\.\.noAutoCapInputProps\}[\s\S]{0,180}className="data-grid-inline-editor-input"/g)?.length || 0;
|
||||
|
||||
expect(source).toContain("import { applyNoAutoCapAttributesWithin, noAutoCapInputProps } from '../utils/inputAutoCap';");
|
||||
expect(editorInputCount).toBe(2);
|
||||
});
|
||||
|
||||
it('renders a quick WHERE condition editor when table filters are visible', () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<DataGrid
|
||||
|
||||
@@ -1018,6 +1018,7 @@ const EditableCell: React.FC<EditableCellProps> = React.memo(({
|
||||
)
|
||||
) : (
|
||||
<Input
|
||||
{...noAutoCapInputProps}
|
||||
ref={inputRef}
|
||||
className="data-grid-inline-editor-input"
|
||||
style={{ width: '100%', ...inputCellPadding }}
|
||||
@@ -5039,6 +5040,7 @@ const DataGrid: React.FC<DataGridProps> = ({
|
||||
)
|
||||
) : (
|
||||
<Input
|
||||
{...noAutoCapInputProps}
|
||||
ref={virtualInlineInputRef}
|
||||
className="data-grid-inline-editor-input"
|
||||
style={{ width: '100%', ...inputCellPadding }}
|
||||
|
||||
Reference in New Issue
Block a user