MCPcopy
hub / github.com/xaboy/form-create / renderRule

Function renderRule

packages/core/src/render/render.js:398–426  ·  view source on GitHub ↗
(rule, children, origin)

Source from the content-addressed store, hash-verified

396 return slotBag.getSlots();
397 },
398 renderRule(rule, children, origin) {
399 if (!rule) return undefined;
400 if (is.String(rule) || is.Number(rule)) return `${rule}`;
401
402 let type;
403 if (origin) {
404 type = rule.type;
405 } else {
406 type = rule.is;
407 if (rule.type) {
408 type = toCase(rule.type);
409 const alias = this.vNode.aliasMap[type];
410 if (alias) type = toCase(alias);
411 }
412 }
413
414 if (!type) return undefined;
415
416 const slotBag = makeSlotBag();
417 if (is.trueArray(rule.children)) {
418 rule.children.forEach(v => {
419 v && slotBag.setSlot(v?.slot, () => this.renderRule(v));
420 });
421 }
422 const props = {...rule};
423 delete props.type;
424 delete props.is;
425 return this.vNode.make(type, props, slotBag.mergeBag(children).getSlots());
426 }
427 })
428}

Callers

nothing calls this directly

Calls 2

makeSlotBagFunction · 0.90
toCaseFunction · 0.85

Tested by

no test coverage detected