Home / Function/ BaseEditor() — supabase Function Reference

BaseEditor() — supabase Function Reference

Architecture documentation for the BaseEditor() function in TimeEditor.tsx from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/studio/components/grid/components/editor/TimeEditor.tsx lines 24–55

function BaseEditor<TRow, TSummaryRow = unknown>({
  row,
  column,
  format,
  onRowChange,
  onClose,
}: TimeEditorProps<TRow, TSummaryRow>) {
  const value = row[column.key as keyof TRow] as unknown as string
  const timeValue = value ? dayjs(value, format).format(INPUT_TIME_FORMAT) : value

  function onChange(event: React.ChangeEvent<HTMLInputElement>) {
    const _value = event.target.value
    if (_value == '') {
      onRowChange({ ...row, [column.key]: null })
    } else {
      const _timeValue = dayjs(_value, INPUT_TIME_FORMAT).format(format)
      onRowChange({ ...row, [column.key]: _timeValue })
    }
  }

  return (
    <input
      className="sb-grid-time-editor"
      ref={autoFocusAndSelect}
      value={timeValue ?? ''}
      onChange={onChange}
      onBlur={() => onClose(true)}
      type="time"
      step="1"
    />
  )
}

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free