@comet/admin-generator 8.0.0-canary-20250715070710 → 8.0.0-canary-20250715073715

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.
@@ -155,6 +155,14 @@ export type GridColumnConfig<T extends GridValidRowModel> = ({
155
155
  * The field to use as label for the default renderCell implementation.
156
156
  */
157
157
  labelField?: string;
158
+ } | {
159
+ type: "oneToMany";
160
+ renderCell?: (params: GridRenderCellParams<T, any, any>) => JSX.Element;
161
+ queryFields?: UsableFields<T, true>[];
162
+ /**
163
+ * The field to use as label for the default renderCell implementation.
164
+ */
165
+ labelField?: string;
158
166
  }) & {
159
167
  name: UsableFields<T>;
160
168
  filterOperators?: GridFilterOperator[];
@@ -144,6 +144,7 @@ function generateGrid({ exportName, baseOutputFilename, targetDirectory, gqlIntr
144
144
  { name: "dataGridDateColumn", importPath: "@comet/admin" },
145
145
  { name: "dataGridIdColumn", importPath: "@comet/admin" },
146
146
  { name: "dataGridManyToManyColumn", importPath: "@comet/admin" },
147
+ { name: "dataGridOneToManyColumn", importPath: "@comet/admin" },
147
148
  { name: "renderStaticSelectCell", importPath: "@comet/admin" },
148
149
  { name: "messages", importPath: "@comet/admin" },
149
150
  { name: "muiGridFilterToGql", importPath: "@comet/admin" },
@@ -430,6 +431,9 @@ function generateGrid({ exportName, baseOutputFilename, targetDirectory, gqlIntr
430
431
  else if (type == "manyToMany") {
431
432
  gridColumnType = "...dataGridManyToManyColumn,";
432
433
  }
434
+ else if (type == "oneToMany") {
435
+ gridColumnType = "...dataGridOneToManyColumn,";
436
+ }
433
437
  if ((column.type == "text" ||
434
438
  column.type == "number" ||
435
439
  column.type == "boolean" ||
@@ -437,7 +441,8 @@ function generateGrid({ exportName, baseOutputFilename, targetDirectory, gqlIntr
437
441
  column.type == "dateTime" ||
438
442
  column.type == "virtual" ||
439
443
  column.type == "id" ||
440
- column.type == "manyToMany") &&
444
+ column.type == "manyToMany" ||
445
+ column.type == "oneToMany") &&
441
446
  column.renderCell) {
442
447
  if ((0, runtimeTypeGuards_1.isGeneratorConfigCode)(column.renderCell)) {
443
448
  renderCell = column.renderCell.code;
@@ -447,9 +452,9 @@ function generateGrid({ exportName, baseOutputFilename, targetDirectory, gqlIntr
447
452
  throw new Error(`Unsupported renderCell for column '${name}', only arrow functions are supported`);
448
453
  }
449
454
  }
450
- if (column.type === "manyToMany" && !column.renderCell) {
455
+ if ((column.type === "manyToMany" || column.type === "oneToMany") && !column.renderCell) {
451
456
  if (!column.labelField) {
452
- throw new Error(`labelField is required for manyToMany column '${name}' if no custom renderCell is provided`);
457
+ throw new Error(`labelField is required for ${column.type} column '${name}' if no custom renderCell is provided`);
453
458
  }
454
459
  renderCell = `({ row }) => <>{row.${column.name}.map((${(0, pluralize_1.singular)(column.name)}) => ${(0, pluralize_1.singular)(column.name)}.${column.labelField}).join(", ")}</>`;
455
460
  }
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@comet/admin-generator",
3
- "version": "8.0.0-canary-20250715070710",
3
+ "version": "8.0.0-canary-20250715073715",
4
+ "description": "Comet Admin Generator CLI tool",
4
5
  "repository": {
5
6
  "directory": "packages/admin/admin-generator",
6
7
  "type": "git",
7
8
  "url": "https://github.com/vivid-planet/comet"
8
9
  },
9
10
  "license": "BSD-2-Clause",
11
+ "type": "commonjs",
10
12
  "main": "lib/index.js",
11
13
  "typings": "lib/index.d.ts",
12
14
  "bin": {
@@ -35,7 +37,7 @@
35
37
  "@types/object-path": "^0.11.4",
36
38
  "@types/pluralize": "^0.0.33",
37
39
  "@types/react": "^18.3.23",
38
- "eslint": "^9.22.0",
40
+ "eslint": "^9.30.1",
39
41
  "final-form": "^4.20.10",
40
42
  "jest": "^29.7.0",
41
43
  "npm-run-all2": "^5.0.2",
@@ -45,10 +47,10 @@
45
47
  "rimraf": "^6.0.1",
46
48
  "ts-jest": "^29.4.0",
47
49
  "typescript": "^5.7.3",
48
- "@comet/admin": "8.0.0-canary-20250715070710",
49
- "@comet/admin-icons": "8.0.0-canary-20250715070710",
50
- "@comet/cms-admin": "8.0.0-canary-20250715070710",
51
- "@comet/eslint-config": "8.0.0-canary-20250715070710"
50
+ "@comet/admin": "8.0.0-canary-20250715073715",
51
+ "@comet/admin-icons": "8.0.0-canary-20250715073715",
52
+ "@comet/cms-admin": "8.0.0-canary-20250715073715",
53
+ "@comet/eslint-config": "8.0.0-canary-20250715073715"
52
54
  },
53
55
  "engines": {
54
56
  "node": ">=22.0.0"