Make bool fields editable again (#6551)

As title
This commit is contained in:
Thomas Trompette
2024-08-06 13:50:55 +02:00
committed by GitHub
parent cd33471159
commit 67c41251fb
2 changed files with 4 additions and 2 deletions

View File

@ -13,8 +13,8 @@ import { RelationPickerHotkeyScope } from '@/object-record/relation-picker/types
import { useInlineCell } from '../hooks/useInlineCell'; import { useInlineCell } from '../hooks/useInlineCell';
import { RecordInlineCellContainer } from './RecordInlineCellContainer';
import { useIsFieldReadOnly } from '@/object-record/record-field/hooks/useIsFieldReadOnly'; import { useIsFieldReadOnly } from '@/object-record/record-field/hooks/useIsFieldReadOnly';
import { RecordInlineCellContainer } from './RecordInlineCellContainer';
type RecordInlineCellProps = { type RecordInlineCellProps = {
readonly?: boolean; readonly?: boolean;

View File

@ -2,6 +2,7 @@ import { useContext } from 'react';
import { FieldInput } from '@/object-record/record-field/components/FieldInput'; import { FieldInput } from '@/object-record/record-field/components/FieldInput';
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext'; import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
import { useIsFieldReadOnly } from '@/object-record/record-field/hooks/useIsFieldReadOnly';
import { FieldInputEvent } from '@/object-record/record-field/types/FieldInputEvent'; import { FieldInputEvent } from '@/object-record/record-field/types/FieldInputEvent';
import { RecordTableContext } from '@/object-record/record-table/contexts/RecordTableContext'; import { RecordTableContext } from '@/object-record/record-table/contexts/RecordTableContext';
@ -9,6 +10,7 @@ export const RecordTableCellFieldInput = () => {
const { onUpsertRecord, onMoveFocus, onCloseTableCell } = const { onUpsertRecord, onMoveFocus, onCloseTableCell } =
useContext(RecordTableContext); useContext(RecordTableContext);
const { entityId, fieldDefinition } = useContext(FieldContext); const { entityId, fieldDefinition } = useContext(FieldContext);
const isFieldReadOnly = useIsFieldReadOnly();
const handleEnter: FieldInputEvent = (persistField) => { const handleEnter: FieldInputEvent = (persistField) => {
onUpsertRecord({ onUpsertRecord({
@ -87,7 +89,7 @@ export const RecordTableCellFieldInput = () => {
onShiftTab={handleShiftTab} onShiftTab={handleShiftTab}
onSubmit={handleSubmit} onSubmit={handleSubmit}
onTab={handleTab} onTab={handleTab}
isReadOnly={true} isReadOnly={isFieldReadOnly}
/> />
); );
}; };