GridCell.tsx 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { CellIdentifier } from '@/appflowy_app/stores/effects/database/cell/cell_bd_svc';
  2. import { CellCache } from '@/appflowy_app/stores/effects/database/cell/cell_cache';
  3. import { FieldController } from '@/appflowy_app/stores/effects/database/field/field_controller';
  4. import { FieldType } from '@/services/backend';
  5. import GridSingleSelectOptions from './GridSingleSelectOptions';
  6. import GridTextCell from './GridTextCell';
  7. import { GridCheckBox } from './GridCheckBox';
  8. import { GridDate } from './GridDate';
  9. import { GridUrl } from './GridUrl';
  10. import { GridNumberCell } from './GridNumberCell';
  11. export const GridCell = ({
  12. cellIdentifier,
  13. cellCache,
  14. fieldController,
  15. }: {
  16. cellIdentifier: CellIdentifier;
  17. cellCache: CellCache;
  18. fieldController: FieldController;
  19. }) => {
  20. return (
  21. <>
  22. {cellIdentifier.fieldType === FieldType.MultiSelect ||
  23. cellIdentifier.fieldType === FieldType.Checklist ||
  24. cellIdentifier.fieldType === FieldType.SingleSelect ? (
  25. <GridSingleSelectOptions
  26. cellIdentifier={cellIdentifier}
  27. cellCache={cellCache}
  28. fieldController={fieldController}
  29. />
  30. ) : cellIdentifier.fieldType === FieldType.Checkbox ? (
  31. <GridCheckBox cellIdentifier={cellIdentifier} cellCache={cellCache} fieldController={fieldController} />
  32. ) : cellIdentifier.fieldType === FieldType.DateTime ? (
  33. <GridDate cellIdentifier={cellIdentifier} cellCache={cellCache} fieldController={fieldController}></GridDate>
  34. ) : cellIdentifier.fieldType === FieldType.URL ? (
  35. <GridUrl cellIdentifier={cellIdentifier} cellCache={cellCache} fieldController={fieldController}></GridUrl>
  36. ) : cellIdentifier.fieldType === FieldType.Number ? (
  37. <GridNumberCell cellIdentifier={cellIdentifier} cellCache={cellCache} fieldController={fieldController} />
  38. ) : (
  39. <GridTextCell cellIdentifier={cellIdentifier} cellCache={cellCache} fieldController={fieldController} />
  40. )}
  41. </>
  42. );
  43. };