From 52352fc068f95efe22c0c359b618c3020caaa358 Mon Sep 17 00:00:00 2001 From: Curtis Reimer Date: Wed, 20 Nov 2024 17:57:15 -0600 Subject: [PATCH] progress --- .../test-project-rsc-kitchen-sink/web/src/lib/formatters.tsx | 4 ++++ __fixtures__/test-project/web/src/lib/formatters.tsx | 4 ++++ packages/cli/src/commands/generate/scaffold/scaffold.js | 5 +++++ .../generate/scaffold/templates/lib/formatters.tsx.template | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/__fixtures__/test-project-rsc-kitchen-sink/web/src/lib/formatters.tsx b/__fixtures__/test-project-rsc-kitchen-sink/web/src/lib/formatters.tsx index 8e5c4376186d..e72dbeb5c221 100644 --- a/__fixtures__/test-project-rsc-kitchen-sink/web/src/lib/formatters.tsx +++ b/__fixtures__/test-project-rsc-kitchen-sink/web/src/lib/formatters.tsx @@ -4,6 +4,10 @@ import humanize from 'humanize-string' const MAX_STRING_LENGTH = 150 +export const bigIntDisplay = (value: bigint) => { + return value.toString() +} + export const formatEnum = (values: string | string[] | null | undefined) => { let output = '' diff --git a/__fixtures__/test-project/web/src/lib/formatters.tsx b/__fixtures__/test-project/web/src/lib/formatters.tsx index 8e5c4376186d..e72dbeb5c221 100644 --- a/__fixtures__/test-project/web/src/lib/formatters.tsx +++ b/__fixtures__/test-project/web/src/lib/formatters.tsx @@ -4,6 +4,10 @@ import humanize from 'humanize-string' const MAX_STRING_LENGTH = 150 +export const bigIntDisplay = (value: bigint) => { + return value.toString() +} + export const formatEnum = (values: string | string[] | null | undefined) => { let output = '' diff --git a/packages/cli/src/commands/generate/scaffold/scaffold.js b/packages/cli/src/commands/generate/scaffold/scaffold.js index ed0beb58da06..509e62e7966c 100644 --- a/packages/cli/src/commands/generate/scaffold/scaffold.js +++ b/packages/cli/src/commands/generate/scaffold/scaffold.js @@ -306,6 +306,11 @@ const modelRelatedVariables = (model) => { listDisplayFunction: 'formatEnum', displayFunction: 'formatEnum', }, + BigInt: { + componentName: 'TextField', + displayFunction: 'bigIntDisplay', + listDisplayFunction: 'truncate', + }, Boolean: { componentName: 'CheckboxField', defaultProp: 'defaultChecked', diff --git a/packages/cli/src/commands/generate/scaffold/templates/lib/formatters.tsx.template b/packages/cli/src/commands/generate/scaffold/templates/lib/formatters.tsx.template index 8e5c4376186d..e72dbeb5c221 100644 --- a/packages/cli/src/commands/generate/scaffold/templates/lib/formatters.tsx.template +++ b/packages/cli/src/commands/generate/scaffold/templates/lib/formatters.tsx.template @@ -4,6 +4,10 @@ import humanize from 'humanize-string' const MAX_STRING_LENGTH = 150 +export const bigIntDisplay = (value: bigint) => { + return value.toString() +} + export const formatEnum = (values: string | string[] | null | undefined) => { let output = ''