feat: add InputGroup and verify shared field integration
This commit is contained in:
@@ -213,7 +213,12 @@ export default defineComponent({
|
||||
const position = `${path}-${index}`;
|
||||
const type = node.type as { name?: string; __name?: string };
|
||||
const name = type?.name ?? type?.__name;
|
||||
if (name === "Input" || name === "TextArea")
|
||||
if (
|
||||
name === "Input" ||
|
||||
name === "TextArea" ||
|
||||
name === "InputGroupInput" ||
|
||||
name === "InputGroupTextArea"
|
||||
)
|
||||
found.controlId = node.props?.id;
|
||||
if (name === "Description" || name === "FieldError") {
|
||||
const kind = name === "Description" ? "description" : "error";
|
||||
@@ -221,6 +226,22 @@ export default defineComponent({
|
||||
found[kind].push(String(id));
|
||||
return cloneVNode(node, { id });
|
||||
}
|
||||
// InputGroup is a library-owned transparent field wrapper. Prepare its
|
||||
// default slot once, preserving the current render's values and keys.
|
||||
// Arbitrary consumer components remain opaque to SSR planning.
|
||||
if (
|
||||
name === "InputGroup" &&
|
||||
node.children &&
|
||||
typeof node.children === "object"
|
||||
) {
|
||||
const groupSlots = node.children as { default?: () => VNodeChild[] };
|
||||
if (typeof groupSlots.default === "function") {
|
||||
const prepared = prepare(groupSlots.default(), found, position);
|
||||
const clone = cloneVNode(node);
|
||||
clone.children = { ...groupSlots, default: () => prepared };
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
if (
|
||||
(typeof node.type === "string" || node.type === Fragment) &&
|
||||
Array.isArray(node.children)
|
||||
|
||||
Reference in New Issue
Block a user