Change to using arrow functions (#1603)
* Change to using arrow functions Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add lint rule --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -6,7 +6,7 @@ import { isCellInEditModeFamilyState } from '../../states/isCellInEditModeFamily
|
||||
|
||||
import { useCurrentCellPosition } from './useCurrentCellPosition';
|
||||
|
||||
export function useCurrentCellEditMode() {
|
||||
export const useCurrentCellEditMode = () => {
|
||||
const moveEditModeToCellPosition = useMoveEditModeToCellPosition();
|
||||
|
||||
const currentCellPosition = useCurrentCellPosition();
|
||||
@ -20,4 +20,4 @@ export function useCurrentCellEditMode() {
|
||||
}, [currentCellPosition, moveEditModeToCellPosition]);
|
||||
|
||||
return { isCurrentCellInEditMode, setCurrentCellInEditMode };
|
||||
}
|
||||
};
|
||||
|
||||
@ -4,7 +4,7 @@ import { ColumnIndexContext } from '../../contexts/ColumnIndexContext';
|
||||
import { RowIndexContext } from '../../contexts/RowIndexContext';
|
||||
import { CellPosition } from '../../types/CellPosition';
|
||||
|
||||
export function useCurrentCellPosition() {
|
||||
export const useCurrentCellPosition = () => {
|
||||
const currentRowNumber = useContext(RowIndexContext);
|
||||
const currentColumnNumber = useContext(ColumnIndexContext);
|
||||
|
||||
@ -17,4 +17,4 @@ export function useCurrentCellPosition() {
|
||||
);
|
||||
|
||||
return currentCellPosition;
|
||||
}
|
||||
};
|
||||
|
||||
@ -14,7 +14,7 @@ const DEFAULT_CELL_SCOPE: HotkeyScope = {
|
||||
scope: TableHotkeyScope.CellEditMode,
|
||||
};
|
||||
|
||||
export function useEditableCell() {
|
||||
export const useEditableCell = () => {
|
||||
const { setCurrentCellInEditMode } = useCurrentCellEditMode();
|
||||
|
||||
const setHotkeyScope = useSetHotkeyScope();
|
||||
@ -24,13 +24,13 @@ export function useEditableCell() {
|
||||
|
||||
const customCellHotkeyScope = useContext(CellHotkeyScopeContext);
|
||||
|
||||
function closeEditableCell() {
|
||||
const closeEditableCell = () => {
|
||||
setDragSelectionStartEnabled(true);
|
||||
closeCurrentCellInEditMode();
|
||||
setHotkeyScope(TableHotkeyScope.TableSoftFocus);
|
||||
}
|
||||
};
|
||||
|
||||
function openEditableCell() {
|
||||
const openEditableCell = () => {
|
||||
setDragSelectionStartEnabled(false);
|
||||
setCurrentCellInEditMode();
|
||||
|
||||
@ -42,10 +42,10 @@ export function useEditableCell() {
|
||||
} else {
|
||||
setHotkeyScope(DEFAULT_CELL_SCOPE.scope, DEFAULT_CELL_SCOPE.customScopes);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
closeEditableCell,
|
||||
openEditableCell,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@ -4,7 +4,7 @@ import { isSoftFocusOnCellFamilyState } from '../../states/isSoftFocusOnCellFami
|
||||
|
||||
import { useCurrentCellPosition } from './useCurrentCellPosition';
|
||||
|
||||
export function useIsSoftFocusOnCurrentCell() {
|
||||
export const useIsSoftFocusOnCurrentCell = () => {
|
||||
const currentCellPosition = useCurrentCellPosition();
|
||||
|
||||
const isSoftFocusOnCell = useRecoilValue(
|
||||
@ -12,4 +12,4 @@ export function useIsSoftFocusOnCurrentCell() {
|
||||
);
|
||||
|
||||
return isSoftFocusOnCell;
|
||||
}
|
||||
};
|
||||
|
||||
@ -7,11 +7,11 @@ import { TableHotkeyScope } from '../../types/TableHotkeyScope';
|
||||
import { useCurrentCellEditMode } from './useCurrentCellEditMode';
|
||||
import { useEditableCell } from './useEditableCell';
|
||||
|
||||
export function useRegisterCloseCellHandlers(
|
||||
export const useRegisterCloseCellHandlers = (
|
||||
wrapperRef: React.RefObject<HTMLDivElement>,
|
||||
onSubmit?: () => void,
|
||||
onCancel?: () => void,
|
||||
) {
|
||||
) => {
|
||||
const { closeEditableCell } = useEditableCell();
|
||||
const { isCurrentCellInEditMode } = useCurrentCellEditMode();
|
||||
|
||||
@ -72,4 +72,4 @@ export function useRegisterCloseCellHandlers(
|
||||
TableHotkeyScope.CellEditMode,
|
||||
[closeEditableCell, onSubmit, moveRight],
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -8,7 +8,7 @@ import { TableHotkeyScope } from '../../types/TableHotkeyScope';
|
||||
|
||||
import { useCurrentCellPosition } from './useCurrentCellPosition';
|
||||
|
||||
export function useSetSoftFocusOnCurrentCell() {
|
||||
export const useSetSoftFocusOnCurrentCell = () => {
|
||||
const setSoftFocusPosition = useSetSoftFocusPosition();
|
||||
|
||||
const currentCellPosition = useCurrentCellPosition();
|
||||
@ -26,4 +26,4 @@ export function useSetSoftFocusOnCurrentCell() {
|
||||
},
|
||||
[setHotkeyScope, currentCellPosition, setSoftFocusPosition],
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user