Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
TrangPham committed Mar 8, 2024
1 parent ceb60e3 commit ddcf042
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/renderers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const rendererRegistryEntries: JsonFormsRendererRegistryEntry[] = [
{ tester: rankWith(2, isStringControl), renderer: withJsonFormsControlProps(TextControl) },
{ tester: rankWith(2, uiTypeIs("Label")), renderer: withJsonFormsLabelProps(AlertControl) },
{ tester: rankWith(2, isNumberControl), renderer: withJsonFormsControlProps(NumberControl) },
{ tester: rankWith(2, isDateTimeControl),renderer: withJsonFormsControlProps(DatetimeControl) }
// { tester: rankWith(2, isDateTimeControl),renderer: withJsonFormsControlProps(DatetimeControl) }
];

export const cellRegistryEntries: JsonFormsCellRendererRegistryEntry[] = [
Expand Down
16 changes: 14 additions & 2 deletions src/stories/controls/DatetimeControl.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Meta, StoryObj } from "@storybook/react";
import { rendererRegistryEntries } from "../../renderers";
import { cellRegistryEntries, rendererRegistryEntries } from "../../renderers";
import { StorybookAntDJsonForm } from "../../common/StorybookAntDJsonForm";
import { datetimeSchema, datetimeUISchema } from "../../testSchemas/datetimeSchema";
import { JsonForms } from "@jsonforms/react";

const meta: Meta<typeof StorybookAntDJsonForm> = {
title: "Control/Datetime",
Expand All @@ -28,6 +29,17 @@ export const Datetime: Story = {
tags: ["autodocs"],
args: {
jsonSchema: datetimeSchema,
// uiSchema: datetimeUISchema,
uiSchema: datetimeUISchema,
},
}

export const DateTimeControl: Story = {
render: () => (
<JsonForms
data={{datetime: "2023-07-18T01:02:01.182Z"}}
schema={datetimeSchema}
cells={[...cellRegistryEntries]}
renderers={[...rendererRegistryEntries]}
/>
),
}

0 comments on commit ddcf042

Please sign in to comment.