@comet/admin-generator 8.0.0-beta.5 → 8.0.0-beta.6
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.
|
@@ -116,6 +116,11 @@ export type StaticSelectLabelCellContent = {
|
|
|
116
116
|
secondaryText?: string;
|
|
117
117
|
icon?: Icon;
|
|
118
118
|
};
|
|
119
|
+
type StaticSelectValue = string | number | boolean;
|
|
120
|
+
type StaticSelectValueObject = {
|
|
121
|
+
value: StaticSelectValue;
|
|
122
|
+
label: string | StaticSelectLabelCellContent;
|
|
123
|
+
};
|
|
119
124
|
export type GridColumnConfig<T extends GridValidRowModel> = ({
|
|
120
125
|
type: "text";
|
|
121
126
|
renderCell?: (params: GridRenderCellParams<T, any, any>) => JSX.Element;
|
|
@@ -135,10 +140,7 @@ export type GridColumnConfig<T extends GridValidRowModel> = ({
|
|
|
135
140
|
renderCell?: (params: GridRenderCellParams<T, any, any>) => JSX.Element;
|
|
136
141
|
} | {
|
|
137
142
|
type: "staticSelect";
|
|
138
|
-
values?: Array<
|
|
139
|
-
value: string;
|
|
140
|
-
label: string | StaticSelectLabelCellContent;
|
|
141
|
-
} | string>;
|
|
143
|
+
values?: Array<StaticSelectValue | StaticSelectValueObject>;
|
|
142
144
|
} | {
|
|
143
145
|
type: "block";
|
|
144
146
|
block: BlockInterface;
|
|
@@ -140,7 +140,6 @@ function generateFormField({ gqlIntrospection, baseOutputFilename, config, formC
|
|
|
140
140
|
let formValueToGqlInputCode = "";
|
|
141
141
|
let formFragmentField = name;
|
|
142
142
|
if (config.type == "text") {
|
|
143
|
-
const required = config.required !== undefined ? config.required : false; // don't use inferred from gql here, non-nullable textinput allows empty string
|
|
144
143
|
const TextInputComponent = config.multiline ? "TextAreaField" : "TextField";
|
|
145
144
|
code = `
|
|
146
145
|
<${TextInputComponent}
|
|
@@ -160,7 +159,7 @@ function generateFormField({ gqlIntrospection, baseOutputFilename, config, formC
|
|
|
160
159
|
${validateCode}
|
|
161
160
|
/>`;
|
|
162
161
|
if (!config.virtual && !required && !config.readOnly) {
|
|
163
|
-
formValueToGqlInputCode = `${name}: formValues.${name} ??
|
|
162
|
+
formValueToGqlInputCode = `${name}: formValues.${name} ?? null,`;
|
|
164
163
|
}
|
|
165
164
|
}
|
|
166
165
|
else if (config.type == "number") {
|
|
@@ -401,10 +401,10 @@ function generateGrid({ exportName, baseOutputFilename, targetDirectory, gqlIntr
|
|
|
401
401
|
throw new Error(`Enum type not found`);
|
|
402
402
|
}
|
|
403
403
|
const values = columnValues.map((value) => {
|
|
404
|
-
if (typeof value === "string") {
|
|
404
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
405
405
|
return {
|
|
406
406
|
value,
|
|
407
|
-
label: (0, camelCaseToHumanReadable_1.camelCaseToHumanReadable)(value),
|
|
407
|
+
label: (0, camelCaseToHumanReadable_1.camelCaseToHumanReadable)(value.toString()),
|
|
408
408
|
};
|
|
409
409
|
}
|
|
410
410
|
else {
|
|
@@ -413,7 +413,7 @@ function generateGrid({ exportName, baseOutputFilename, targetDirectory, gqlIntr
|
|
|
413
413
|
});
|
|
414
414
|
const valueOptions = `[${values
|
|
415
415
|
.map(({ value, label }) => {
|
|
416
|
-
const labelData = getValueOptionsLabelData(`${instanceGqlType}.${name}.${value.charAt(0).toLowerCase() + value.slice(1)}`, label);
|
|
416
|
+
const labelData = getValueOptionsLabelData(`${instanceGqlType}.${name}.${value.toString().charAt(0).toLowerCase() + value.toString().slice(1)}`, label);
|
|
417
417
|
return `{
|
|
418
418
|
value: ${JSON.stringify(value)},
|
|
419
419
|
label: ${labelData.textLabel},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comet/admin-generator",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"directory": "packages/admin/admin-generator",
|
|
6
6
|
"type": "git",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@mui/material": "^7.1.0",
|
|
32
32
|
"@mui/x-data-grid": "^7.29.4",
|
|
33
33
|
"@types/jest": "^29.5.14",
|
|
34
|
-
"@types/node": "^22.15.
|
|
34
|
+
"@types/node": "^22.15.34",
|
|
35
35
|
"@types/object-path": "^0.11.4",
|
|
36
36
|
"@types/pluralize": "^0.0.33",
|
|
37
37
|
"@types/react": "^18.3.22",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"rimraf": "^6.0.1",
|
|
46
46
|
"ts-jest": "^29.2.6",
|
|
47
47
|
"typescript": "^5.7.3",
|
|
48
|
-
"@comet/admin": "8.0.0-beta.
|
|
49
|
-
"@comet/admin-icons": "8.0.0-beta.
|
|
50
|
-
"@comet/cms-admin": "8.0.0-beta.
|
|
51
|
-
"@comet/eslint-config": "8.0.0-beta.
|
|
48
|
+
"@comet/admin": "8.0.0-beta.6",
|
|
49
|
+
"@comet/admin-icons": "8.0.0-beta.6",
|
|
50
|
+
"@comet/cms-admin": "8.0.0-beta.6",
|
|
51
|
+
"@comet/eslint-config": "8.0.0-beta.6"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22.0.0"
|