@ghentcdh/crouton-core 0.0.1-alpha.74 → 0.0.1-alpha.76
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.
- package/dist/index.cjs +23 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -180,6 +180,7 @@ __export(index_exports, {
|
|
|
180
180
|
isZodSchema: () => isZodSchema,
|
|
181
181
|
jsonSchemaOpts: () => jsonSchemaOpts,
|
|
182
182
|
labelFromId: () => labelFromId,
|
|
183
|
+
makeOptionalPropertiesNullable: () => makeOptionalPropertiesNullable,
|
|
183
184
|
mergeFieldVariant: () => mergeFieldVariant,
|
|
184
185
|
normalizeColumns: () => normalizeColumns,
|
|
185
186
|
normalizeLabel: () => normalizeLabel,
|
|
@@ -419,6 +420,26 @@ var dropNullableFromRequired = (schema) => {
|
|
|
419
420
|
if (filteredRequired.length === required.length) return schema;
|
|
420
421
|
return { ...schema, required: filteredRequired };
|
|
421
422
|
};
|
|
423
|
+
var makeOptionalPropertiesNullable = (schema) => {
|
|
424
|
+
if (!schema?.properties) return schema;
|
|
425
|
+
const requiredSet = new Set(
|
|
426
|
+
Array.isArray(schema.required) ? schema.required : []
|
|
427
|
+
);
|
|
428
|
+
const patched = { ...schema.properties };
|
|
429
|
+
let changed = false;
|
|
430
|
+
for (const key of Object.keys(patched)) {
|
|
431
|
+
if (requiredSet.has(key)) continue;
|
|
432
|
+
const prop = patched[key];
|
|
433
|
+
if (!prop || typeof prop !== "object") continue;
|
|
434
|
+
if (isNullableProperty(prop)) continue;
|
|
435
|
+
const type = prop["type"];
|
|
436
|
+
if (typeof type === "string" && type !== "null") {
|
|
437
|
+
patched[key] = { ...prop, type: [type, "null"] };
|
|
438
|
+
changed = true;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return changed ? { ...schema, properties: patched } : schema;
|
|
442
|
+
};
|
|
422
443
|
var enforceRequiredStringMinLength = (schema) => {
|
|
423
444
|
if (!schema?.properties) return schema;
|
|
424
445
|
const patchedProperties = { ...schema.properties };
|
|
@@ -2514,7 +2535,7 @@ var buildViewsWithSource = (source, columns, layout) => {
|
|
|
2514
2535
|
(c) => !c.hiddenInForm,
|
|
2515
2536
|
formUiBuilder,
|
|
2516
2537
|
true,
|
|
2517
|
-
(c) => !c.idField && (c.createable === true || c.updateable === true)
|
|
2538
|
+
(c) => !c.idField && !c.hiddenInForm && (c.createable === true || c.updateable === true)
|
|
2518
2539
|
);
|
|
2519
2540
|
if (form) {
|
|
2520
2541
|
applyRequiredColumns(form.json_schema, columns);
|
|
@@ -3637,6 +3658,7 @@ var resolveLanguage = (acceptLanguage, supported, defaultLanguage) => {
|
|
|
3637
3658
|
isZodSchema,
|
|
3638
3659
|
jsonSchemaOpts,
|
|
3639
3660
|
labelFromId,
|
|
3661
|
+
makeOptionalPropertiesNullable,
|
|
3640
3662
|
mergeFieldVariant,
|
|
3641
3663
|
normalizeColumns,
|
|
3642
3664
|
normalizeLabel,
|