schema-components 1.12.4 → 1.12.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.
|
@@ -147,10 +147,9 @@ function renderField(tree, value, onChange, userResolver, renderChild, instanceW
|
|
|
147
147
|
} catch (err) {
|
|
148
148
|
throw new SchemaRenderError(err instanceof Error ? err.message : `Render function threw for type "${tree.type}"`, tree, tree.type, err);
|
|
149
149
|
}
|
|
150
|
-
if (result
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
150
|
+
if (result === null || result === void 0) return null;
|
|
151
|
+
if (isValidElement(result)) return result;
|
|
152
|
+
if (typeof result === "string" || typeof result === "number") return result;
|
|
154
153
|
}
|
|
155
154
|
if (value === void 0 || value === null) return /* @__PURE__ */ jsx("span", { children: "—" });
|
|
156
155
|
return /* @__PURE__ */ jsx("span", { children: typeof value === "string" ? value : JSON.stringify(value) });
|
package/dist/react/headless.mjs
CHANGED
|
@@ -249,6 +249,8 @@ function renderObject(props) {
|
|
|
249
249
|
updated[key] = v;
|
|
250
250
|
props.onChange(updated);
|
|
251
251
|
};
|
|
252
|
+
const child = toReactNode(props.renderChild(field, childValue, childOnChange));
|
|
253
|
+
if (child === null || child === void 0) return null;
|
|
252
254
|
return /* @__PURE__ */ jsxs("div", { children: [typeof field.meta.description === "string" && /* @__PURE__ */ jsxs("label", {
|
|
253
255
|
htmlFor: childId,
|
|
254
256
|
children: [field.meta.description, field.isOptional === false && /* @__PURE__ */ jsxs("span", {
|
|
@@ -256,7 +258,7 @@ function renderObject(props) {
|
|
|
256
258
|
style: { color: "#dc2626" },
|
|
257
259
|
children: [" ", "*"]
|
|
258
260
|
})]
|
|
259
|
-
}),
|
|
261
|
+
}), child] }, key);
|
|
260
262
|
})] });
|
|
261
263
|
}
|
|
262
264
|
function renderRecord(props) {
|
|
@@ -290,6 +292,7 @@ function renderArray(props) {
|
|
|
290
292
|
const arr = Array.isArray(props.value) ? props.value : [];
|
|
291
293
|
const element = props.element;
|
|
292
294
|
if (element === void 0) return null;
|
|
295
|
+
if (props.readOnly && arr.length === 0) return null;
|
|
293
296
|
return /* @__PURE__ */ jsx("div", {
|
|
294
297
|
role: "group",
|
|
295
298
|
"aria-label": props.meta.description ?? void 0,
|