@nestledjs/data-browser 1.0.13 → 1.0.14
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,7 +106,6 @@ 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);
|
|
110
109
|
const idField = model.fields.find((f) => f.isId);
|
|
111
110
|
if (idField) {
|
|
112
111
|
initialValues[idField.name] = item[idField.name];
|
|
@@ -129,32 +128,16 @@ function extractInitialValues(model, item) {
|
|
|
129
128
|
if (!Array.isArray(value)) {
|
|
130
129
|
value = [];
|
|
131
130
|
}
|
|
132
|
-
const arrayValue = value;
|
|
133
131
|
value = value.join(",");
|
|
134
|
-
console.log(`[DataBrowser] Enum array field detected - "${field.name}":`, {
|
|
135
|
-
type: field.type,
|
|
136
|
-
arrayValue,
|
|
137
|
-
convertedValue: value
|
|
138
|
-
});
|
|
139
132
|
} else if (fieldTypeLower === "datetime" || fieldTypeLower === "date") {
|
|
140
133
|
value = processDateFieldValue(field, value);
|
|
141
134
|
} else {
|
|
142
135
|
value = sanitizeFieldValue(value, field);
|
|
143
136
|
}
|
|
144
137
|
initialValues[field.name] = value;
|
|
145
|
-
if (value !== null && typeof value === "string" && fieldTypeLower !== "string" && fieldTypeLower !== "datetime" && fieldTypeLower !== "date") {
|
|
146
|
-
console.log(`[DataBrowser] Enum field detected - "${field.name}":`, {
|
|
147
|
-
type: field.type,
|
|
148
|
-
kind: field.kind,
|
|
149
|
-
isList: field.isList,
|
|
150
|
-
extractedValue: value,
|
|
151
|
-
rawValue: item[field.name]
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
138
|
}
|
|
155
139
|
});
|
|
156
140
|
performFinalSafetyChecks(initialValues, model);
|
|
157
|
-
console.log(`[DataBrowser] Final initial values for ${model.name}:`, initialValues);
|
|
158
141
|
return initialValues;
|
|
159
142
|
}
|
|
160
143
|
const validateId = (id) => {
|
|
@@ -505,7 +488,6 @@ function AdminDataEditPageContent({ model, id, basePath, formTheme, displayField
|
|
|
505
488
|
});
|
|
506
489
|
const initialValues = extractInitialValues(model, item);
|
|
507
490
|
const handleSubmit = async (formData) => {
|
|
508
|
-
console.log(`[DataBrowser] Form submission for ${model.name}:`, formData);
|
|
509
491
|
setSubmissionState({ status: "loading" });
|
|
510
492
|
const result = await executeUpdateMutation(updateMutation, formData, model, id, idVariableName);
|
|
511
493
|
setSubmissionState({
|
|
@@ -514,9 +496,7 @@ function AdminDataEditPageContent({ model, id, basePath, formTheme, displayField
|
|
|
514
496
|
});
|
|
515
497
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
516
498
|
if (result.success) {
|
|
517
|
-
|
|
518
|
-
const refetchResult = await refetch();
|
|
519
|
-
console.log(`[DataBrowser] Refetch complete for ${model.name}:`, refetchResult.data);
|
|
499
|
+
await refetch();
|
|
520
500
|
}
|
|
521
501
|
};
|
|
522
502
|
const handleDelete = async () => {
|
|
@@ -191,22 +191,11 @@ 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
|
-
isList: field.isList
|
|
200
|
-
});
|
|
201
194
|
if (field.isList) {
|
|
202
195
|
let defaultValue = "";
|
|
203
196
|
if (Array.isArray(initialValue) && initialValue.length > 0) {
|
|
204
197
|
defaultValue = initialValue.join(",");
|
|
205
198
|
}
|
|
206
|
-
console.log(`[DataBrowser] Array enum field "${field.name}" converted:`, {
|
|
207
|
-
arrayValue: initialValue,
|
|
208
|
-
stringValue: defaultValue
|
|
209
|
-
});
|
|
210
199
|
const checkboxOptions = enumValues.map((value) => ({
|
|
211
200
|
key: value,
|
|
212
201
|
value,
|
|
@@ -461,7 +450,6 @@ function processNestedObject(value, model) {
|
|
|
461
450
|
}
|
|
462
451
|
function cleanFormInput(input, model) {
|
|
463
452
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
464
|
-
console.log(`[DataBrowser] Cleaning form input for ${model == null ? void 0 : model.name}:`, input);
|
|
465
453
|
const cleaned = {};
|
|
466
454
|
const booleanFields = new Set(
|
|
467
455
|
((_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)) || []
|
|
@@ -480,10 +468,6 @@ function cleanFormInput(input, model) {
|
|
|
480
468
|
if (enumArrayFields.has(key)) {
|
|
481
469
|
if (typeof value === "string") {
|
|
482
470
|
const arrayValue = value.split(",").filter((v) => v.trim() !== "");
|
|
483
|
-
console.log(`[DataBrowser] Converting enum array "${key}":`, {
|
|
484
|
-
stringValue: value,
|
|
485
|
-
arrayValue
|
|
486
|
-
});
|
|
487
471
|
cleaned[key] = arrayValue;
|
|
488
472
|
continue;
|
|
489
473
|
} else if (Array.isArray(value)) {
|
|
@@ -521,7 +505,6 @@ function cleanFormInput(input, model) {
|
|
|
521
505
|
}
|
|
522
506
|
cleaned[key] = value;
|
|
523
507
|
}
|
|
524
|
-
console.log(`[DataBrowser] Cleaned form input for ${model == null ? void 0 : model.name}:`, cleaned);
|
|
525
508
|
return cleaned;
|
|
526
509
|
}
|
|
527
510
|
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.14",
|
|
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.14",
|
|
42
42
|
"react": "^19.0.0",
|
|
43
43
|
"react-router": "^7.0.0"
|
|
44
44
|
},
|