@nestledjs/data-browser 1.0.9 → 1.0.10
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.
|
@@ -106,6 +106,7 @@ function extractInitialValues(model, item) {
|
|
|
106
106
|
if (!item) {
|
|
107
107
|
return initialValues;
|
|
108
108
|
}
|
|
109
|
+
console.log(`[DataBrowser] Extracting initial values for ${model.name}:`, item);
|
|
109
110
|
const idField = model.fields.find((f) => f.isId);
|
|
110
111
|
if (idField) {
|
|
111
112
|
initialValues[idField.name] = item[idField.name];
|
|
@@ -130,9 +131,17 @@ function extractInitialValues(model, item) {
|
|
|
130
131
|
value = sanitizeFieldValue(value, field);
|
|
131
132
|
}
|
|
132
133
|
initialValues[field.name] = value;
|
|
134
|
+
if (value !== null && typeof value === "string" && fieldTypeLower !== "string" && fieldTypeLower !== "datetime" && fieldTypeLower !== "date") {
|
|
135
|
+
console.log(`[DataBrowser] Enum field detected - "${field.name}":`, {
|
|
136
|
+
type: field.type,
|
|
137
|
+
extractedValue: value,
|
|
138
|
+
rawValue: item[field.name]
|
|
139
|
+
});
|
|
140
|
+
}
|
|
133
141
|
}
|
|
134
142
|
});
|
|
135
143
|
performFinalSafetyChecks(initialValues, model);
|
|
144
|
+
console.log(`[DataBrowser] Final initial values for ${model.name}:`, initialValues);
|
|
136
145
|
return initialValues;
|
|
137
146
|
}
|
|
138
147
|
const validateId = (id) => {
|
|
@@ -483,6 +492,7 @@ function AdminDataEditPageContent({ model, id, basePath, formTheme, displayField
|
|
|
483
492
|
});
|
|
484
493
|
const initialValues = extractInitialValues(model, item);
|
|
485
494
|
const handleSubmit = async (formData) => {
|
|
495
|
+
console.log(`[DataBrowser] Form submission for ${model.name}:`, formData);
|
|
486
496
|
setSubmissionState({ status: "loading" });
|
|
487
497
|
const result = await executeUpdateMutation(updateMutation, formData, model, id, idVariableName);
|
|
488
498
|
setSubmissionState({
|
|
@@ -491,7 +501,9 @@ function AdminDataEditPageContent({ model, id, basePath, formTheme, displayField
|
|
|
491
501
|
});
|
|
492
502
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
493
503
|
if (result.success) {
|
|
494
|
-
|
|
504
|
+
console.log(`[DataBrowser] Update successful, refetching data for ${model.name}...`);
|
|
505
|
+
const refetchResult = await refetch();
|
|
506
|
+
console.log(`[DataBrowser] Refetch complete for ${model.name}:`, refetchResult.data);
|
|
495
507
|
}
|
|
496
508
|
};
|
|
497
509
|
const handleDelete = async () => {
|
|
@@ -191,14 +191,18 @@ function buildFormFields(sdk, model, operation, options = {}) {
|
|
|
191
191
|
default: {
|
|
192
192
|
const enumValues = getEnumValues(sdk, field.type);
|
|
193
193
|
if (enumValues) {
|
|
194
|
+
console.log(`[DataBrowser] Building enum field "${field.name}":`, {
|
|
195
|
+
enumType: field.type,
|
|
196
|
+
availableValues: enumValues,
|
|
197
|
+
currentValue: initialValue,
|
|
198
|
+
operation
|
|
199
|
+
});
|
|
194
200
|
const selectOptions = enumValues.map((value) => ({
|
|
195
201
|
value,
|
|
196
202
|
label: value.replace(/_/g, " ").toLowerCase().replace(/^./, (str) => str.toUpperCase())
|
|
197
203
|
}));
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
options: selectOptions
|
|
201
|
-
});
|
|
204
|
+
const enumOptions = operation === "update" ? { label: options2.label, required: options2.required, options: selectOptions } : { ...options2, options: selectOptions };
|
|
205
|
+
formField = FormFieldClass.select(field.name, enumOptions);
|
|
202
206
|
break;
|
|
203
207
|
}
|
|
204
208
|
if (field.relationName && !field.isList) {
|
|
@@ -432,6 +436,7 @@ function processNestedObject(value, model) {
|
|
|
432
436
|
}
|
|
433
437
|
function cleanFormInput(input, model) {
|
|
434
438
|
var _a, _b, _c, _d, _e;
|
|
439
|
+
console.log(`[DataBrowser] Cleaning form input for ${model == null ? void 0 : model.name}:`, input);
|
|
435
440
|
const cleaned = {};
|
|
436
441
|
const booleanFields = new Set(
|
|
437
442
|
((_b = (_a = model == null ? void 0 : model.fields) == null ? void 0 : _a.filter((field) => field.type.toLowerCase() === "boolean")) == null ? void 0 : _b.map((field) => field.name)) || []
|
|
@@ -471,6 +476,7 @@ function cleanFormInput(input, model) {
|
|
|
471
476
|
}
|
|
472
477
|
cleaned[key] = value;
|
|
473
478
|
}
|
|
479
|
+
console.log(`[DataBrowser] Cleaned form input for ${model == null ? void 0 : model.name}:`, cleaned);
|
|
474
480
|
return cleaned;
|
|
475
481
|
}
|
|
476
482
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestledjs/data-browser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "Universal admin data browser for Nestled framework projects with full CRUD operations",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@apollo/client": "^4.0.0",
|
|
39
39
|
"@heroicons/react": "^2.0.0",
|
|
40
40
|
"@nestledjs/forms": "^0.6.3",
|
|
41
|
-
"@nestledjs/shared-components": "^1.0.
|
|
41
|
+
"@nestledjs/shared-components": "^1.0.10",
|
|
42
42
|
"react": "^19.0.0",
|
|
43
43
|
"react-router": "^7.0.0"
|
|
44
44
|
},
|