@constructive-io/sheets 0.3.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +19 -24
  2. package/dist/advanced.cjs +659 -474
  3. package/dist/advanced.cjs.map +1 -1
  4. package/dist/advanced.d.cts +9 -10
  5. package/dist/advanced.d.ts +9 -10
  6. package/dist/advanced.js +3 -3
  7. package/dist/auth.cjs +10 -10
  8. package/dist/auth.cjs.map +1 -1
  9. package/dist/auth.d.cts +5 -4
  10. package/dist/auth.d.ts +5 -4
  11. package/dist/auth.js +3 -3
  12. package/dist/{chunk-GLVZSPV2.js → chunk-4EZ6A23C.js} +4 -3
  13. package/dist/chunk-4EZ6A23C.js.map +1 -0
  14. package/dist/{chunk-FNVHSOQQ.js → chunk-KKAWMVEG.js} +11 -11
  15. package/dist/chunk-KKAWMVEG.js.map +1 -0
  16. package/dist/{chunk-4PGPVMZB.js → chunk-KOZAW264.js} +4 -3
  17. package/dist/chunk-KOZAW264.js.map +1 -0
  18. package/dist/{chunk-ODUBS2NL.js → chunk-KVPVEXWB.js} +40 -17
  19. package/dist/chunk-KVPVEXWB.js.map +1 -0
  20. package/dist/{chunk-TU7ATZ4X.js → chunk-LR64FLWO.js} +301 -410
  21. package/dist/chunk-LR64FLWO.js.map +1 -0
  22. package/dist/chunk-ZETPUEXH.js +494 -0
  23. package/dist/chunk-ZETPUEXH.js.map +1 -0
  24. package/dist/{date-editor-CXKKGNL6.js → date-editor-QT47WY5T.js} +5 -3
  25. package/dist/date-editor-QT47WY5T.js.map +1 -0
  26. package/dist/{editor-props-M6Dh0P9f.d.ts → grid-cell-types-C3ARj148.d.cts} +70 -62
  27. package/dist/{editor-props-M6Dh0P9f.d.cts → grid-cell-types-C3ARj148.d.ts} +70 -62
  28. package/dist/index.cjs +1150 -703
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +123 -35
  31. package/dist/index.d.ts +123 -35
  32. package/dist/index.js +323 -99
  33. package/dist/index.js.map +1 -1
  34. package/dist/{sheets-context-CojEFlaY.d.cts → sheets-context-B03WDhZ9.d.cts} +36 -6
  35. package/dist/{sheets-context-Da55TTR9.d.ts → sheets-context-DmVCOgiX.d.ts} +36 -6
  36. package/dist/styles.css +6 -0
  37. package/dist/testing.cjs +476 -108
  38. package/dist/testing.cjs.map +1 -1
  39. package/dist/testing.d.cts +11 -7
  40. package/dist/testing.d.ts +11 -7
  41. package/dist/testing.js +34 -8
  42. package/dist/testing.js.map +1 -1
  43. package/package.json +15 -16
  44. package/dist/chunk-4PGPVMZB.js.map +0 -1
  45. package/dist/chunk-FNVHSOQQ.js.map +0 -1
  46. package/dist/chunk-GLVZSPV2.js.map +0 -1
  47. package/dist/chunk-H4JJTMP5.js +0 -160
  48. package/dist/chunk-H4JJTMP5.js.map +0 -1
  49. package/dist/chunk-ODUBS2NL.js.map +0 -1
  50. package/dist/chunk-TU7ATZ4X.js.map +0 -1
  51. package/dist/date-editor-CXKKGNL6.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/grid/editors/date-editor.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { parseDate as parseAriaDate } from '@internationalized/date';\nimport type { DateValue as DateValueType } from 'react-aria-components';\n\nimport { Button } from '@constructive-io/ui/button';\nimport { Calendar } from '@constructive-io/ui/calendar-rac';\n\nimport { DATE_TIME_TYPES } from '../../cell-types/cell-type-groups';\nimport { sheetsLocale } from '../../utils/sheets-i18n';\n\nimport { EditorFocusTrap } from './editor-focus-trap';\nimport { OVERLAY } from './overlay-presets';\n\nconst TIME_RE = /(\\d{1,2}):(\\d{2})(?::(\\d{2}))?(?:\\.\\d+)?/;\nconst MAC_UA_RE = /Mac|iPod|iPhone|iPad/;\n\nexport type DateEditorType = 'date' | 'datetime' | 'timestamptz' | 'time';\n\nconst DATE_ONLY_RE = /^\\d{4}-\\d{2}-\\d{2}/;\n\nfunction pad2(value: number): string {\n\treturn String(value).padStart(2, '0');\n}\n\n// Format a Date as a calendar date string using LOCAL getters (never UTC).\n// This is the correct serialization for date-only values: the wall-clock day\n// the user picked is preserved regardless of timezone.\nexport function toLocalDateString(d: Date): string {\n\treturn `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;\n}\n\n// If the value is a string whose literal calendar date is already known\n// (starts with YYYY-MM-DD), return that 10-char slice verbatim. Otherwise null.\n// Date-only strings must never round-trip through a Date object.\nexport function extractDateOnly(v: unknown): string | null {\n\tif (typeof v === 'string' && DATE_ONLY_RE.test(v)) {\n\t\treturn v.slice(0, 10);\n\t}\n\treturn null;\n}\n\nfunction normalizeTimeValue(value: unknown): string {\n\tif (value == null) return '';\n\n\tif (value instanceof Date) {\n\t\tif (isNaN(value.getTime())) return '';\n\t\treturn `${pad2(value.getHours())}:${pad2(value.getMinutes())}:${pad2(value.getSeconds())}`;\n\t}\n\n\tconst asString = String(value).trim();\n\tif (!asString) return '';\n\n\t// Match both time-only values and datetime-like values with a time component.\n\tconst match = asString.match(TIME_RE);\n\tif (!match) return '';\n\n\tconst hours = Number(match[1] ?? 0);\n\tconst minutes = Number(match[2] ?? 0);\n\tconst seconds = Number(match[3] ?? 0);\n\tif (\n\t\t!Number.isFinite(hours) ||\n\t\t!Number.isFinite(minutes) ||\n\t\t!Number.isFinite(seconds) ||\n\t\thours < 0 ||\n\t\thours > 23 ||\n\t\tminutes < 0 ||\n\t\tminutes > 59 ||\n\t\tseconds < 0 ||\n\t\tseconds > 59\n\t) {\n\t\treturn '';\n\t}\n\n\treturn `${pad2(hours)}:${pad2(minutes)}:${pad2(seconds)}`;\n}\n\n// Determine date type from cell data or explicit context\nexport const getDateType = (value: any): DateEditorType => {\n\t// Try to infer from the value format\n\tif (typeof value === 'string') {\n\t\tif (value.includes('T') || value.includes(' ')) {\n\t\t\treturn value.includes('+') || value.includes('Z') ? 'timestamptz' : 'datetime';\n\t\t}\n\t\tif (value.includes(':') && !value.includes('-')) {\n\t\t\treturn 'time';\n\t\t}\n\t}\n\treturn 'date'; // Default fallback\n};\n\nexport function resolveDateType(value: unknown, explicitType?: string): DateEditorType {\n\tif (explicitType && DATE_TIME_TYPES.has(explicitType)) {\n\t\treturn explicitType as DateEditorType;\n\t}\n\treturn getDateType(value);\n}\n\n// Format date for display based on type\nexport const formatDate = (val: unknown, dateType: DateEditorType): string => {\n\tif (!val) return '';\n\n\tif (dateType === 'time') {\n\t\tif (typeof val === 'string') {\n\t\t\treturn val.trim();\n\t\t}\n\t\tconst normalized = normalizeTimeValue(val);\n\t\treturn normalized || String(val);\n\t}\n\n\ttry {\n\t\t// Date-only display must use the literal calendar date, never a UTC\n\t\t// conversion (which shifts the day in any UTC+ zone). Prefer the literal\n\t\t// slice and never round-trip a Date.\n\t\tif (dateType === 'date') {\n\t\t\tconst literal = extractDateOnly(val);\n\t\t\tif (literal) return literal;\n\t\t\tif (val instanceof Date) {\n\t\t\t\treturn isNaN(val.getTime()) ? String(val) : toLocalDateString(val);\n\t\t\t}\n\t\t\treturn String(val);\n\t\t}\n\n\t\tlet date: Date;\n\t\tif (val instanceof Date) {\n\t\t\tdate = val;\n\t\t} else if (typeof val === 'string') {\n\t\t\tdate = new Date(val);\n\t\t} else {\n\t\t\treturn String(val);\n\t\t}\n\n\t\tif (isNaN(date.getTime())) return String(val);\n\n\t\tswitch (dateType) {\n\t\t\tcase 'datetime':\n\t\t\tcase 'timestamptz':\n\t\t\t\treturn date.toLocaleDateString(sheetsLocale(), {\n\t\t\t\t\tyear: 'numeric',\n\t\t\t\t\tmonth: 'short',\n\t\t\t\t\tday: 'numeric',\n\t\t\t\t\thour: '2-digit',\n\t\t\t\t\tminute: '2-digit',\n\t\t\t\t\thour12: false,\n\t\t\t\t});\n\t\t\tdefault: {\n\t\t\t\t// Default branch is treated as date-only semantics.\n\t\t\t\tconst literal = extractDateOnly(val);\n\t\t\t\tif (literal) return literal;\n\t\t\t\treturn toLocalDateString(date);\n\t\t\t}\n\t\t}\n\t} catch {\n\t\treturn String(val);\n\t}\n};\n\n// Format date for input based on type\nexport const formatForInput = (val: unknown, inputType: string): string => {\n\tif (!val) return '';\n\n\tif (inputType === 'time') {\n\t\treturn normalizeTimeValue(val);\n\t}\n\n\t// Date-only input must reflect the literal calendar date, never a UTC shift.\n\tif (inputType === 'date') {\n\t\tconst literal = extractDateOnly(val);\n\t\tif (literal) return literal;\n\t\tif (val instanceof Date) {\n\t\t\treturn isNaN(val.getTime()) ? '' : toLocalDateString(val);\n\t\t}\n\t\treturn '';\n\t}\n\n\ttry {\n\t\tlet date: Date;\n\t\tif (val instanceof Date) {\n\t\t\tdate = val;\n\t\t} else if (typeof val === 'string') {\n\t\t\tdate = new Date(val);\n\t\t} else {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (isNaN(date.getTime())) return '';\n\n\t\tswitch (inputType) {\n\t\t\tcase 'datetime-local':\n\t\t\t\treturn date.toISOString().slice(0, 16);\n\t\t\tdefault:\n\t\t\t\treturn '';\n\t\t}\n\t} catch {\n\t\treturn '';\n\t}\n};\n\n// Convert a date input to a DateValue for the calendar.\n// Date-only strings are parsed by their literal calendar date (no Date round-trip),\n// so the calendar seeds on exactly the stored day in any timezone.\nconst dateToDateValue = (date: Date | string | null): DateValueType | null => {\n\tif (!date) return null;\n\n\ttry {\n\t\tconst literal = extractDateOnly(date);\n\t\tif (literal) {\n\t\t\treturn parseAriaDate(literal);\n\t\t}\n\n\t\tconst jsDate = date instanceof Date ? date : new Date(date);\n\t\tif (isNaN(jsDate.getTime())) return null;\n\n\t\treturn parseAriaDate(toLocalDateString(jsDate));\n\t} catch {\n\t\treturn null;\n\t}\n};\n\n// Convert DateValue to JavaScript Date\nconst dateValueToDate = (dateValue: DateValueType | null): Date | null => {\n\tif (!dateValue) return null;\n\n\ttry {\n\t\treturn new Date(dateValue.year, dateValue.month - 1, dateValue.day);\n\t} catch {\n\t\treturn null;\n\t}\n};\n\n// Derive a date-only string from a calendar value (year/month/day) without any\n// UTC conversion. Pure and DOM-free so the write path is directly testable; it\n// mirrors handleSave's date-only serialization (local-midnight Date → local getters).\nexport function dateOnlyStringFromCalendarValue(dateValue: DateValueType | null): string {\n\tconst date = dateValueToDate(dateValue);\n\treturn date ? toLocalDateString(date) : '';\n}\n\ninterface DateEditorProps {\n\tvalue: unknown;\n\tonFinishedEditing: (next?: unknown) => void;\n\tdateType?: DateEditorType;\n}\n\nexport const DateEditor: React.FC<DateEditorProps> = ({ value, onFinishedEditing, dateType: forcedDateType }) => {\n\t// Extract current date data from the raw value\n\tconst currentDateValue = typeof value === 'string' ? value : '';\n\tconst dateType = resolveDateType(currentDateValue, forcedDateType);\n\n\tconst [dateValue, setDateValue] = useState<string | Date | null>(currentDateValue);\n\tconst [selectedDate, setSelectedDate] = useState<DateValueType | null>(\n\t\tdateToDateValue(currentDateValue || new Date()),\n\t);\n\n\tconst keyContainerRef = useRef<HTMLDivElement>(null);\n\n\tconst isTimeOnly = dateType === 'time';\n\tconst isDateTimeType = dateType === 'datetime' || dateType === 'timestamptz';\n\n\tconst handleDateSelect = useCallback(\n\t\t(dateValue: DateValueType | readonly DateValueType[] | null) => {\n\t\t\t// The shared Calendar also supports multi-select, so its public\n\t\t\t// callback includes arrays. This editor is intentionally single-date.\n\t\t\tif (Array.isArray(dateValue)) return;\n\t\t\tconst selectedValue = dateValue as DateValueType | null;\n\t\t\tsetSelectedDate(selectedValue);\n\t\t\tconst jsDate = dateValueToDate(selectedValue);\n\n\t\t\tif (jsDate) {\n\t\t\t\t// For datetime types, preserve existing time if available\n\t\t\t\tif (isDateTimeType && currentDateValue) {\n\t\t\t\t\tconst currentDate = new Date(currentDateValue);\n\t\t\t\t\tif (!isNaN(currentDate.getTime())) {\n\t\t\t\t\t\tjsDate.setHours(currentDate.getHours(), currentDate.getMinutes(), currentDate.getSeconds());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsetDateValue(jsDate);\n\t\t\t}\n\t\t},\n\t\t[isDateTimeType, currentDateValue],\n\t);\n\n\tconst handleTimeChange = useCallback(\n\t\t(timeValue: string) => {\n\t\t\tif (!timeValue) return;\n\n\t\t\tif (isTimeOnly) {\n\t\t\t\tconst normalizedTime = normalizeTimeValue(timeValue);\n\t\t\t\tsetDateValue(normalizedTime);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [hours, minutes, seconds = 0] = timeValue.split(':').map(Number);\n\t\t\tconst targetDate: Date = selectedDate\n\t\t\t\t? dateValueToDate(selectedDate) || new Date()\n\t\t\t\t: currentDateValue\n\t\t\t\t\t? new Date(currentDateValue)\n\t\t\t\t\t: new Date();\n\n\t\t\ttargetDate.setHours(hours || 0, minutes || 0, seconds || 0, 0);\n\t\t\tsetDateValue(targetDate);\n\t\t},\n\t\t[isTimeOnly, selectedDate, currentDateValue],\n\t);\n\n\tconst handleSave = useCallback(() => {\n\t\tlet finalValue: string;\n\n\t\tif (!dateValue) {\n\t\t\tfinalValue = '';\n\t\t} else {\n\t\t\tif (dateType === 'time') {\n\t\t\t\tfinalValue = normalizeTimeValue(dateValue);\n\t\t\t\tif (!finalValue) {\n\t\t\t\t\tfinalValue = String(dateValue).trim();\n\t\t\t\t}\n\t\t\t\treturn onFinishedEditing(finalValue);\n\t\t\t}\n\n\t\t\t// Date-only path: serialize the literal calendar date with LOCAL getters.\n\t\t\t// A UTC conversion (toISOString) shifts the day backwards in any UTC+\n\t\t\t// zone — that is the write corruption this guards against.\n\t\t\tif (dateType === 'date') {\n\t\t\t\tconst literal = extractDateOnly(dateValue);\n\t\t\t\tif (literal) {\n\t\t\t\t\tfinalValue = literal;\n\t\t\t\t} else if (dateValue instanceof Date) {\n\t\t\t\t\tfinalValue = isNaN(dateValue.getTime()) ? '' : toLocalDateString(dateValue);\n\t\t\t\t} else {\n\t\t\t\t\tfinalValue = '';\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst date = dateValue instanceof Date ? dateValue : new Date(dateValue);\n\n\t\t\t\tif (isNaN(date.getTime())) {\n\t\t\t\t\tfinalValue = '';\n\t\t\t\t} else {\n\t\t\t\t\tswitch (dateType) {\n\t\t\t\t\t\tcase 'datetime':\n\t\t\t\t\t\t\tfinalValue = date.toISOString().slice(0, 19); // Remove Z\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'timestamptz':\n\t\t\t\t\t\t\tfinalValue = date.toISOString();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t// Default branch is treated as date-only semantics.\n\t\t\t\t\t\t\tconst literal = extractDateOnly(dateValue);\n\t\t\t\t\t\t\tfinalValue = literal ?? toLocalDateString(date);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Emit the raw formatted date string\n\t\tonFinishedEditing(finalValue);\n\t}, [dateValue, dateType, onFinishedEditing]);\n\n\tconst handleCancel = useCallback(() => {\n\t\tonFinishedEditing();\n\t}, [onFinishedEditing]);\n\n\t// Refs for native key handler\n\tconst actionsRef = useRef({ handleSave, handleCancel });\n\tactionsRef.current = { handleSave, handleCancel };\n\n\t// Native DOM keydown listener — prevents Glide from intercepting keys in portal context\n\tuseEffect(() => {\n\t\tconst el = keyContainerRef.current;\n\t\tif (!el) return;\n\t\tconst handler = (e: KeyboardEvent) => {\n\t\t\tconst { handleSave, handleCancel } = actionsRef.current;\n\n\t\t\tif (e.key === 'Escape') {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\thandleCancel();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ((e.key === 'Enter' && (e.metaKey || e.ctrlKey)) || (e.key === 's' && (e.metaKey || e.ctrlKey))) {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\thandleSave();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Stop Tab from reaching Glide\n\t\t\tif (e.key === 'Tab') {\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t};\n\t\tel.addEventListener('keydown', handler);\n\t\treturn () => el.removeEventListener('keydown', handler);\n\t}, []);\n\n\tconst displayValue = formatDate(dateValue, dateType);\n\n\tconst isMac = typeof navigator !== 'undefined' && MAC_UA_RE.test(navigator.userAgent);\n\tconst modKey = isMac ? '⌘' : 'Ctrl';\n\n\treturn (\n\t\t<EditorFocusTrap\n\t\t\tonEscape={handleCancel}\n\t\t\tclassName={`bg-popover ${OVERLAY.sm} rounded-lg border p-2.5 shadow-lg`}\n\t\t>\n\t\t\t<div ref={keyContainerRef}>\n\t\t\t\t{isTimeOnly ? (\n\t\t\t\t\t// Time-only: compact input\n\t\t\t\t\t<div className='space-y-2'>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\ttype='time'\n\t\t\t\t\t\t\tstep='1'\n\t\t\t\t\t\t\tvalue={formatForInput(dateValue, 'time')}\n\t\t\t\t\t\t\tonChange={(e) => handleTimeChange(e.target.value)}\n\t\t\t\t\t\t\tclassName='bg-muted/40 border-border/40 text-foreground w-full rounded-md border px-3 py-2 text-sm outline-none focus:border-primary/60 focus:ring-2 focus:ring-primary/20'\n\t\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t// Date / DateTime: calendar + optional time\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{/* Selected date display */}\n\t\t\t\t\t\t<div className='text-muted-foreground mb-1 px-1 text-xs font-medium tabular-nums'>\n\t\t\t\t\t\t\t{displayValue || 'No date selected'}\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t{/* Calendar */}\n\t\t\t\t\t\t<Calendar\n\t\t\t\t\t\t\tvalue={selectedDate}\n\t\t\t\t\t\t\tonChange={handleDateSelect}\n\t\t\t\t\t\t\taria-label='Select date'\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t{/* Time input for datetime types */}\n\t\t\t\t\t\t{isDateTimeType && (\n\t\t\t\t\t\t\t<div className='mt-2 px-1'>\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\ttype='time'\n\t\t\t\t\t\t\t\t\tstep='1'\n\t\t\t\t\t\t\t\t\tvalue={dateValue ? new Date(dateValue).toTimeString().split(' ')[0].slice(0, 8) : ''}\n\t\t\t\t\t\t\t\t\tonChange={(e) => handleTimeChange(e.target.value)}\n\t\t\t\t\t\t\t\t\tclassName='bg-muted/40 border-border/40 text-foreground w-full rounded-md border px-2.5 py-1.5 text-sm outline-none focus:border-primary/60 focus:ring-2 focus:ring-primary/20'\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t{/* Footer — hints + save */}\n\t\t\t\t<div className='mt-3 flex items-center justify-between gap-4 border-t px-1 pt-2.5'>\n\t\t\t\t\t<div className='text-muted-foreground flex items-center gap-3 text-xs'>\n\t\t\t\t\t\t<span className='inline-flex shrink-0 items-center gap-1'>\n\t\t\t\t\t\t\t<kbd className='bg-muted/60 border-border/40 inline-flex min-h-5 min-w-5 items-center justify-center rounded border font-sans text-[11px] leading-tight'>{modKey}</kbd>\n\t\t\t\t\t\t\t<kbd className='bg-muted/60 border-border/40 inline-flex min-h-5 min-w-5 items-center justify-center rounded border font-sans text-[11px] leading-tight'>↵</kbd>\n\t\t\t\t\t\t\t<span>save</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span className='inline-flex shrink-0 items-center gap-1'>\n\t\t\t\t\t\t\t<kbd className='bg-muted/60 border-border/40 inline-flex min-h-5 items-center justify-center rounded border px-1.5 font-sans text-[11px] leading-tight'>Esc</kbd>\n\t\t\t\t\t\t\t<span>cancel</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Button onClick={handleSave} size='xs' variant='default' className='shrink-0'>\n\t\t\t\t\t\tSave\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t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UAAK,WAAU,2CACf;AAAA,kCAAC,SAAI,WAAU,2IAA2I,kBAAO;AAAA,cACjK,oBAAC,SAAI,WAAU,2IAA0I,oBAAC;AAAA,cAC1J,oBAAC,UAAK,kBAAI;AAAA,eACX;AAAA,YACA,qBAAC,UAAK,WAAU,2CACf;AAAA,kCAAC,SAAI,WAAU,0IAAyI,iBAAG;AAAA,cAC3J,oBAAC,UAAK,oBAAM;AAAA,eACb;AAAA,aACD;AAAA,UACA,oBAAC,UAAO,SAAS,YAAY,MAAK,MAAK,SAAQ,WAAU,WAAU,YAAW,kBAE9E;AAAA,WACD;AAAA,SACD;AAAA;AAAA,EACD;AAEF;","names":["dateValue","handleSave","handleCancel"]}
@@ -1,10 +1,30 @@
1
1
  import { ComponentType } from 'react';
2
2
  import { MetaQuery } from '@constructive-io/data';
3
3
 
4
+ interface FieldMetadata$1 {
5
+ name: string;
6
+ type?: {
7
+ gqlType: string;
8
+ pgType?: string | null;
9
+ pgAlias?: string | null;
10
+ isArray?: boolean;
11
+ subtype?: string | null;
12
+ };
13
+ }
14
+ interface CellTypeResolution {
15
+ cellType: string;
16
+ canEdit: boolean;
17
+ canActivate: boolean;
18
+ activationBehavior: 'single-click' | 'double-click';
19
+ isReadonly: boolean;
20
+ }
21
+ declare function resolveCellType(fieldName: string, fieldMeta?: FieldMetadata$1): CellTypeResolution;
22
+ declare function isImageField(fieldMeta?: FieldMetadata$1, fieldName?: string): boolean;
23
+
4
24
  type CellType = 'text' | 'textarea' | 'email' | 'url' | 'phone' | 'citext' | 'bpchar' | 'number' | 'integer' | 'smallint' | 'decimal' | 'currency' | 'percentage' | 'date' | 'datetime' | 'time' | 'timestamptz' | 'interval' | 'boolean' | 'toggle' | 'bit' | 'json' | 'jsonb' | 'array' | 'text-array' | 'uuid-array' | 'number-array' | 'integer-array' | 'date-array' | 'geometry' | 'geometry-point' | 'geometry-collection' | 'inet' | 'image' | 'file' | 'video' | 'audio' | 'upload' | 'uuid' | 'color' | 'rating' | 'tags' | 'tsvector' | 'origin' | 'relation' | 'unknown';
5
25
  type CellCategory = 'text' | 'numeric' | 'date' | 'boolean' | 'structured' | 'geometric' | 'network' | 'media' | 'special' | 'other';
6
26
  type CellValue = string | number | boolean | Date | null | undefined | Array<any> | Record<string, any>;
7
- interface FieldMetadata$1 {
27
+ interface FieldMetadata {
8
28
  name: string;
9
29
  gqlType: string;
10
30
  isArray: boolean;
@@ -13,6 +33,14 @@ interface FieldMetadata$1 {
13
33
  pgType?: string | null;
14
34
  subtype?: string | null;
15
35
  typmod?: number | null;
36
+ encoding?: {
37
+ kind: string;
38
+ elementType?: string | null;
39
+ dimensions?: number | null;
40
+ geometrySubtype?: string | null;
41
+ srid?: number | null;
42
+ dotPath?: boolean | null;
43
+ } | null;
16
44
  }
17
45
  interface ColumnSchema {
18
46
  id: string;
@@ -114,65 +142,6 @@ interface CellPlugin {
114
142
  uninstall?: () => void;
115
143
  }
116
144
 
117
- interface FieldMetadata {
118
- name: string;
119
- type?: {
120
- gqlType: string;
121
- pgType?: string | null;
122
- pgAlias?: string | null;
123
- isArray?: boolean;
124
- subtype?: string | null;
125
- };
126
- }
127
- interface CellTypeResolution {
128
- cellType: string;
129
- canEdit: boolean;
130
- canActivate: boolean;
131
- activationBehavior: 'single-click' | 'double-click';
132
- isReadonly: boolean;
133
- }
134
- declare function resolveCellType(fieldName: string, fieldMeta?: FieldMetadata): CellTypeResolution;
135
- declare function isImageField(fieldMeta?: FieldMetadata, fieldName?: string): boolean;
136
-
137
- type RelationKind = 'belongsTo' | 'hasOne' | 'hasMany' | 'manyToMany';
138
- interface RelationInfo {
139
- kind: RelationKind;
140
- relatedTable?: string;
141
- displayCandidates: string[];
142
- relationField?: string;
143
- foreignKeyField?: string;
144
- junctionTable?: string;
145
- junctionLeftKeyField?: string;
146
- junctionRightKeyField?: string;
147
- displayName?: string;
148
- }
149
- interface RelationInfoSlice {
150
- relationInfoCache: Record<string, Record<string, RelationInfo>>;
151
- relationInfoMapCache: Record<string, Map<string, RelationInfo>>;
152
- setRelationInfoForTable: (tableName: string, info: Record<string, RelationInfo>) => void;
153
- getRelationInfoForTable: (tableName: string) => Record<string, RelationInfo> | undefined;
154
- getRelationInfoMapForTable: (tableName: string) => Map<string, RelationInfo> | undefined;
155
- rebuildRelationInfo: (tableName: string, meta: MetaQuery | undefined) => void;
156
- ensureRelationInfo: (tableName: string, meta: MetaQuery | undefined) => Record<string, RelationInfo>;
157
- clearRelationInfoCache: () => void;
158
- }
159
- declare function buildRelationInfoFromMeta(tableName: string, meta: MetaQuery | undefined): Record<string, RelationInfo> | null;
160
-
161
- interface RelationCellOptions {
162
- relationChipLimit?: number;
163
- relationLabelMaxLength?: number;
164
- }
165
- interface CellCreationMetadata {
166
- cellType: string;
167
- fieldName: string;
168
- fieldMeta?: FieldMetadata;
169
- relationInfo?: RelationInfo;
170
- relationOptions?: RelationCellOptions;
171
- canEdit: boolean;
172
- isReadonly: boolean;
173
- activationBehavior: 'single-click' | 'double-click';
174
- }
175
-
176
145
  /**
177
146
  * Neutral RENDER kinds — equal to the frozen `DisplayKind` union. `loading` and
178
147
  * `draft-action` originate from grid-internal state, not the `CellType` system.
@@ -206,6 +175,30 @@ interface SheetsCell {
206
175
  };
207
176
  }
208
177
 
178
+ type RelationKind = 'belongsTo' | 'hasOne' | 'hasMany' | 'manyToMany';
179
+ interface RelationInfo {
180
+ kind: RelationKind;
181
+ relatedTable?: string;
182
+ displayCandidates: string[];
183
+ relationField?: string;
184
+ foreignKeyField?: string;
185
+ junctionTable?: string;
186
+ junctionLeftKeyField?: string;
187
+ junctionRightKeyField?: string;
188
+ displayName?: string;
189
+ }
190
+ interface RelationInfoSlice {
191
+ relationInfoCache: Record<string, Record<string, RelationInfo>>;
192
+ relationInfoMapCache: Record<string, Map<string, RelationInfo>>;
193
+ setRelationInfoForTable: (tableName: string, info: Record<string, RelationInfo>) => void;
194
+ getRelationInfoForTable: (tableName: string) => Record<string, RelationInfo> | undefined;
195
+ getRelationInfoMapForTable: (tableName: string) => Map<string, RelationInfo> | undefined;
196
+ rebuildRelationInfo: (tableName: string, meta: MetaQuery | undefined) => void;
197
+ ensureRelationInfo: (tableName: string, meta: MetaQuery | undefined) => Record<string, RelationInfo>;
198
+ clearRelationInfoCache: () => void;
199
+ }
200
+ declare function buildRelationInfoFromMeta(tableName: string, meta: MetaQuery | undefined): Record<string, RelationInfo> | null;
201
+
209
202
  interface EditorProps {
210
203
  value: unknown;
211
204
  cell: SheetsCell;
@@ -213,7 +206,7 @@ interface EditorProps {
213
206
  rowId: string;
214
207
  rowIndex: number;
215
208
  tableName?: string;
216
- fieldMeta?: FieldMetadata;
209
+ fieldMeta?: FieldMetadata$1;
217
210
  relationInfo?: RelationInfo;
218
211
  /**
219
212
  * Type-to-edit seed: when the overlay was opened by typing a printable char on the
@@ -242,4 +235,19 @@ interface EditorProps {
242
235
  };
243
236
  }
244
237
 
245
- export { type BaseCellProps as B, type CellCreationMetadata as C, type EditorProps as E, type FieldMetadata as F, type RelationInfo as R, type SheetsCell as S, type TableSchema as T, type SheetsCellKind as a, type CellType as b, type CellCategory as c, type RelationInfoSlice as d, type CellRegistryEntry as e, type CellRenderer as f, type CellPlugin as g, type ColumnSchema as h, type RelationKind as i, buildRelationInfoFromMeta as j, isImageField as k, type CellValue as l, type FieldMetadata$1 as m, type RowData as n, resolveCellType as r };
238
+ interface RelationCellOptions {
239
+ relationChipLimit?: number;
240
+ relationLabelMaxLength?: number;
241
+ }
242
+ interface CellCreationMetadata {
243
+ cellType: string;
244
+ fieldName: string;
245
+ fieldMeta?: FieldMetadata$1;
246
+ relationInfo?: RelationInfo;
247
+ relationOptions?: RelationCellOptions;
248
+ canEdit: boolean;
249
+ isReadonly: boolean;
250
+ activationBehavior: 'single-click' | 'double-click';
251
+ }
252
+
253
+ export { type BaseCellProps as B, type CellCreationMetadata as C, type EditorProps as E, type FieldMetadata$1 as F, type RelationInfo as R, type SheetsCell as S, type TableSchema as T, type SheetsCellKind as a, type CellType as b, type CellCategory as c, type RelationInfoSlice as d, type CellRegistryEntry as e, type CellRenderer as f, type CellPlugin as g, type ColumnSchema as h, type CellValue as i, type FieldMetadata as j, type RelationKind as k, type RowData as l, buildRelationInfoFromMeta as m, isImageField as n, resolveCellType as r };
@@ -1,10 +1,30 @@
1
1
  import { ComponentType } from 'react';
2
2
  import { MetaQuery } from '@constructive-io/data';
3
3
 
4
+ interface FieldMetadata$1 {
5
+ name: string;
6
+ type?: {
7
+ gqlType: string;
8
+ pgType?: string | null;
9
+ pgAlias?: string | null;
10
+ isArray?: boolean;
11
+ subtype?: string | null;
12
+ };
13
+ }
14
+ interface CellTypeResolution {
15
+ cellType: string;
16
+ canEdit: boolean;
17
+ canActivate: boolean;
18
+ activationBehavior: 'single-click' | 'double-click';
19
+ isReadonly: boolean;
20
+ }
21
+ declare function resolveCellType(fieldName: string, fieldMeta?: FieldMetadata$1): CellTypeResolution;
22
+ declare function isImageField(fieldMeta?: FieldMetadata$1, fieldName?: string): boolean;
23
+
4
24
  type CellType = 'text' | 'textarea' | 'email' | 'url' | 'phone' | 'citext' | 'bpchar' | 'number' | 'integer' | 'smallint' | 'decimal' | 'currency' | 'percentage' | 'date' | 'datetime' | 'time' | 'timestamptz' | 'interval' | 'boolean' | 'toggle' | 'bit' | 'json' | 'jsonb' | 'array' | 'text-array' | 'uuid-array' | 'number-array' | 'integer-array' | 'date-array' | 'geometry' | 'geometry-point' | 'geometry-collection' | 'inet' | 'image' | 'file' | 'video' | 'audio' | 'upload' | 'uuid' | 'color' | 'rating' | 'tags' | 'tsvector' | 'origin' | 'relation' | 'unknown';
5
25
  type CellCategory = 'text' | 'numeric' | 'date' | 'boolean' | 'structured' | 'geometric' | 'network' | 'media' | 'special' | 'other';
6
26
  type CellValue = string | number | boolean | Date | null | undefined | Array<any> | Record<string, any>;
7
- interface FieldMetadata$1 {
27
+ interface FieldMetadata {
8
28
  name: string;
9
29
  gqlType: string;
10
30
  isArray: boolean;
@@ -13,6 +33,14 @@ interface FieldMetadata$1 {
13
33
  pgType?: string | null;
14
34
  subtype?: string | null;
15
35
  typmod?: number | null;
36
+ encoding?: {
37
+ kind: string;
38
+ elementType?: string | null;
39
+ dimensions?: number | null;
40
+ geometrySubtype?: string | null;
41
+ srid?: number | null;
42
+ dotPath?: boolean | null;
43
+ } | null;
16
44
  }
17
45
  interface ColumnSchema {
18
46
  id: string;
@@ -114,65 +142,6 @@ interface CellPlugin {
114
142
  uninstall?: () => void;
115
143
  }
116
144
 
117
- interface FieldMetadata {
118
- name: string;
119
- type?: {
120
- gqlType: string;
121
- pgType?: string | null;
122
- pgAlias?: string | null;
123
- isArray?: boolean;
124
- subtype?: string | null;
125
- };
126
- }
127
- interface CellTypeResolution {
128
- cellType: string;
129
- canEdit: boolean;
130
- canActivate: boolean;
131
- activationBehavior: 'single-click' | 'double-click';
132
- isReadonly: boolean;
133
- }
134
- declare function resolveCellType(fieldName: string, fieldMeta?: FieldMetadata): CellTypeResolution;
135
- declare function isImageField(fieldMeta?: FieldMetadata, fieldName?: string): boolean;
136
-
137
- type RelationKind = 'belongsTo' | 'hasOne' | 'hasMany' | 'manyToMany';
138
- interface RelationInfo {
139
- kind: RelationKind;
140
- relatedTable?: string;
141
- displayCandidates: string[];
142
- relationField?: string;
143
- foreignKeyField?: string;
144
- junctionTable?: string;
145
- junctionLeftKeyField?: string;
146
- junctionRightKeyField?: string;
147
- displayName?: string;
148
- }
149
- interface RelationInfoSlice {
150
- relationInfoCache: Record<string, Record<string, RelationInfo>>;
151
- relationInfoMapCache: Record<string, Map<string, RelationInfo>>;
152
- setRelationInfoForTable: (tableName: string, info: Record<string, RelationInfo>) => void;
153
- getRelationInfoForTable: (tableName: string) => Record<string, RelationInfo> | undefined;
154
- getRelationInfoMapForTable: (tableName: string) => Map<string, RelationInfo> | undefined;
155
- rebuildRelationInfo: (tableName: string, meta: MetaQuery | undefined) => void;
156
- ensureRelationInfo: (tableName: string, meta: MetaQuery | undefined) => Record<string, RelationInfo>;
157
- clearRelationInfoCache: () => void;
158
- }
159
- declare function buildRelationInfoFromMeta(tableName: string, meta: MetaQuery | undefined): Record<string, RelationInfo> | null;
160
-
161
- interface RelationCellOptions {
162
- relationChipLimit?: number;
163
- relationLabelMaxLength?: number;
164
- }
165
- interface CellCreationMetadata {
166
- cellType: string;
167
- fieldName: string;
168
- fieldMeta?: FieldMetadata;
169
- relationInfo?: RelationInfo;
170
- relationOptions?: RelationCellOptions;
171
- canEdit: boolean;
172
- isReadonly: boolean;
173
- activationBehavior: 'single-click' | 'double-click';
174
- }
175
-
176
145
  /**
177
146
  * Neutral RENDER kinds — equal to the frozen `DisplayKind` union. `loading` and
178
147
  * `draft-action` originate from grid-internal state, not the `CellType` system.
@@ -206,6 +175,30 @@ interface SheetsCell {
206
175
  };
207
176
  }
208
177
 
178
+ type RelationKind = 'belongsTo' | 'hasOne' | 'hasMany' | 'manyToMany';
179
+ interface RelationInfo {
180
+ kind: RelationKind;
181
+ relatedTable?: string;
182
+ displayCandidates: string[];
183
+ relationField?: string;
184
+ foreignKeyField?: string;
185
+ junctionTable?: string;
186
+ junctionLeftKeyField?: string;
187
+ junctionRightKeyField?: string;
188
+ displayName?: string;
189
+ }
190
+ interface RelationInfoSlice {
191
+ relationInfoCache: Record<string, Record<string, RelationInfo>>;
192
+ relationInfoMapCache: Record<string, Map<string, RelationInfo>>;
193
+ setRelationInfoForTable: (tableName: string, info: Record<string, RelationInfo>) => void;
194
+ getRelationInfoForTable: (tableName: string) => Record<string, RelationInfo> | undefined;
195
+ getRelationInfoMapForTable: (tableName: string) => Map<string, RelationInfo> | undefined;
196
+ rebuildRelationInfo: (tableName: string, meta: MetaQuery | undefined) => void;
197
+ ensureRelationInfo: (tableName: string, meta: MetaQuery | undefined) => Record<string, RelationInfo>;
198
+ clearRelationInfoCache: () => void;
199
+ }
200
+ declare function buildRelationInfoFromMeta(tableName: string, meta: MetaQuery | undefined): Record<string, RelationInfo> | null;
201
+
209
202
  interface EditorProps {
210
203
  value: unknown;
211
204
  cell: SheetsCell;
@@ -213,7 +206,7 @@ interface EditorProps {
213
206
  rowId: string;
214
207
  rowIndex: number;
215
208
  tableName?: string;
216
- fieldMeta?: FieldMetadata;
209
+ fieldMeta?: FieldMetadata$1;
217
210
  relationInfo?: RelationInfo;
218
211
  /**
219
212
  * Type-to-edit seed: when the overlay was opened by typing a printable char on the
@@ -242,4 +235,19 @@ interface EditorProps {
242
235
  };
243
236
  }
244
237
 
245
- export { type BaseCellProps as B, type CellCreationMetadata as C, type EditorProps as E, type FieldMetadata as F, type RelationInfo as R, type SheetsCell as S, type TableSchema as T, type SheetsCellKind as a, type CellType as b, type CellCategory as c, type RelationInfoSlice as d, type CellRegistryEntry as e, type CellRenderer as f, type CellPlugin as g, type ColumnSchema as h, type RelationKind as i, buildRelationInfoFromMeta as j, isImageField as k, type CellValue as l, type FieldMetadata$1 as m, type RowData as n, resolveCellType as r };
238
+ interface RelationCellOptions {
239
+ relationChipLimit?: number;
240
+ relationLabelMaxLength?: number;
241
+ }
242
+ interface CellCreationMetadata {
243
+ cellType: string;
244
+ fieldName: string;
245
+ fieldMeta?: FieldMetadata$1;
246
+ relationInfo?: RelationInfo;
247
+ relationOptions?: RelationCellOptions;
248
+ canEdit: boolean;
249
+ isReadonly: boolean;
250
+ activationBehavior: 'single-click' | 'double-click';
251
+ }
252
+
253
+ export { type BaseCellProps as B, type CellCreationMetadata as C, type EditorProps as E, type FieldMetadata$1 as F, type RelationInfo as R, type SheetsCell as S, type TableSchema as T, type SheetsCellKind as a, type CellType as b, type CellCategory as c, type RelationInfoSlice as d, type CellRegistryEntry as e, type CellRenderer as f, type CellPlugin as g, type ColumnSchema as h, type CellValue as i, type FieldMetadata as j, type RelationKind as k, type RowData as l, buildRelationInfoFromMeta as m, isImageField as n, resolveCellType as r };