Skip to content

Commit

Permalink
Remove changes for grid-generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Ho committed Feb 23, 2024
1 parent b672bf9 commit 1cc85e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
5 changes: 3 additions & 2 deletions packages/admin/cms-admin/src/generator/future/generateGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "graphql";
import { plural } from "pluralize";

import { GeneratorReturn, GridConfigInternal } from "./generator";
import { GeneratorReturn, GridConfig } from "./generator";
import { camelCaseToHumanReadable } from "./utils/camelCaseToHumanReadable";
import { findRootBlocks } from "./utils/findRootBlocks";

Expand Down Expand Up @@ -62,7 +62,8 @@ export function generateGrid(
targetDirectory,
gqlIntrospection,
}: { exportName: string; baseOutputFilename: string; targetDirectory: string; gqlIntrospection: IntrospectionQuery },
config: GridConfigInternal,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
config: GridConfig<any>,
): GeneratorReturn {
const gqlType = config.gqlType;
const gqlTypePlural = plural(gqlType);
Expand Down
16 changes: 5 additions & 11 deletions packages/admin/cms-admin/src/generator/future/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type FormFieldConfigInternal = (
| { type: "staticSelect"; values?: string[] }
| { type: "asyncSelect"; values?: string[] }
| { type: "block"; block: ImportReference }
) & { name: string; label?: string; required?: boolean; validate?: ImportReference; helperText?: string };
) & { name: string; label?: string; required?: boolean; validate?: ImportReference; helperText?: string };
export type FormFieldConfig<T extends GeneratorEntity> = FormFieldConfigInternal & { name: Leaves<T> | Paths<T> };

export type FormConfigInternal = {
Expand All @@ -42,25 +42,19 @@ export type FormConfig<T extends GeneratorEntity> = FormConfigInternal & {

export type TabsConfig = { type: "tabs"; tabs: { name: string; content: GeneratorConfig }[] };

export type GridColumnConfigInternal = (
export type GridColumnConfig<T extends GeneratorEntity> = (
| { type: "text" }
| { type: "number" }
| { type: "boolean" }
| { type: "date" }
| { type: "dateTime" }
| { type: "staticSelect"; values?: string[] }
| { type: "block"; block: ImportReference }
) & { name: string; headerName?: string; width?: number };
export type GridColumnConfig<T extends GeneratorEntity> = GridColumnConfigInternal & { name: Leaves<T> | Paths<T> };

export type GridConfigInternal = {
) & { name: keyof T; headerName?: string; width?: number };
export type GridConfig<T extends GeneratorEntity> = {
type: "grid";
gqlType: string;
fragmentName?: string;
columns: GridColumnConfigInternal[];
};
export type GridConfig<T extends GeneratorEntity> = GridConfigInternal & {
gqlType: T["__typename"];
fragmentName?: string;
columns: GridColumnConfig<T>[];
};

Expand Down

0 comments on commit 1cc85e6

Please sign in to comment.