mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat/integrate number to grid
This commit is contained in:
parent
4d5a3ee13d
commit
764ec73e94
@ -10,6 +10,7 @@ import GridTextCell from './GridTextCell';
|
|||||||
import { GridCheckBox } from './GridCheckBox';
|
import { GridCheckBox } from './GridCheckBox';
|
||||||
import { GridDate } from './GridDate';
|
import { GridDate } from './GridDate';
|
||||||
import { GridUrl } from './GridUrl';
|
import { GridUrl } from './GridUrl';
|
||||||
|
import { GridNumberCell } from './GridNumberCell';
|
||||||
|
|
||||||
export const GridCell = ({
|
export const GridCell = ({
|
||||||
cellIdentifier,
|
cellIdentifier,
|
||||||
@ -22,9 +23,9 @@ export const GridCell = ({
|
|||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{cellIdentifier.fieldType === FieldType.MultiSelect || cellIdentifier.fieldType === FieldType.Checklist ? (
|
{cellIdentifier.fieldType === FieldType.MultiSelect ||
|
||||||
<p> Select solutions</p>
|
cellIdentifier.fieldType === FieldType.Checklist ||
|
||||||
) : cellIdentifier.fieldType === FieldType.SingleSelect ? (
|
cellIdentifier.fieldType === FieldType.SingleSelect ? (
|
||||||
<GridSingleSelectOptions
|
<GridSingleSelectOptions
|
||||||
cellIdentifier={cellIdentifier}
|
cellIdentifier={cellIdentifier}
|
||||||
cellCache={cellCache}
|
cellCache={cellCache}
|
||||||
@ -36,6 +37,8 @@ export const GridCell = ({
|
|||||||
<GridDate cellIdentifier={cellIdentifier} cellCache={cellCache} fieldController={fieldController}></GridDate>
|
<GridDate cellIdentifier={cellIdentifier} cellCache={cellCache} fieldController={fieldController}></GridDate>
|
||||||
) : cellIdentifier.fieldType === FieldType.URL ? (
|
) : cellIdentifier.fieldType === FieldType.URL ? (
|
||||||
<GridUrl cellIdentifier={cellIdentifier} cellCache={cellCache} fieldController={fieldController}></GridUrl>
|
<GridUrl cellIdentifier={cellIdentifier} cellCache={cellCache} fieldController={fieldController}></GridUrl>
|
||||||
|
) : cellIdentifier.fieldType === FieldType.Number ? (
|
||||||
|
<GridNumberCell cellIdentifier={cellIdentifier} cellCache={cellCache} fieldController={fieldController} />
|
||||||
) : (
|
) : (
|
||||||
<GridTextCell cellIdentifier={cellIdentifier} cellCache={cellCache} fieldController={fieldController} />
|
<GridTextCell cellIdentifier={cellIdentifier} cellCache={cellCache} fieldController={fieldController} />
|
||||||
)}
|
)}
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
import { CellIdentifier } from '@/appflowy_app/stores/effects/database/cell/cell_bd_svc';
|
||||||
|
import { CellCache } from '@/appflowy_app/stores/effects/database/cell/cell_cache';
|
||||||
|
import { FieldController } from '@/appflowy_app/stores/effects/database/field/field_controller';
|
||||||
|
import { useCell } from '../../_shared/database-hooks/useCell';
|
||||||
|
import { EditCellNumber } from '../../_shared/EditRow/EditCellNumber';
|
||||||
|
|
||||||
|
export const GridNumberCell = ({
|
||||||
|
cellIdentifier,
|
||||||
|
cellCache,
|
||||||
|
fieldController,
|
||||||
|
}: {
|
||||||
|
cellIdentifier: CellIdentifier;
|
||||||
|
cellCache: CellCache;
|
||||||
|
fieldController: FieldController;
|
||||||
|
}) => {
|
||||||
|
const { data, cellController } = useCell(cellIdentifier, cellCache, fieldController);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full'>
|
||||||
|
{cellController && (
|
||||||
|
<EditCellNumber data={data as string | undefined} cellController={cellController}></EditCellNumber>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
@ -1,7 +1,6 @@
|
|||||||
import { CellIdentifier } from '@/appflowy_app/stores/effects/database/cell/cell_bd_svc';
|
import { CellIdentifier } from '@/appflowy_app/stores/effects/database/cell/cell_bd_svc';
|
||||||
import { CellCache } from '@/appflowy_app/stores/effects/database/cell/cell_cache';
|
import { CellCache } from '@/appflowy_app/stores/effects/database/cell/cell_cache';
|
||||||
import { FieldController } from '@/appflowy_app/stores/effects/database/field/field_controller';
|
import { FieldController } from '@/appflowy_app/stores/effects/database/field/field_controller';
|
||||||
import { useState, useEffect } from 'react';
|
|
||||||
import { useCell } from '../../_shared/database-hooks/useCell';
|
import { useCell } from '../../_shared/database-hooks/useCell';
|
||||||
import { EditCellText } from '../../_shared/EditRow/EditCellText';
|
import { EditCellText } from '../../_shared/EditRow/EditCellText';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user