diff --git a/app/web/src/nova/ed/panel/side/prop-instance/prop-option.tsx b/app/web/src/nova/ed/panel/side/prop-instance/prop-option.tsx index 5a66f21e..b27370cc 100644 --- a/app/web/src/nova/ed/panel/side/prop-instance/prop-option.tsx +++ b/app/web/src/nova/ed/panel/side/prop-instance/prop-option.tsx @@ -295,13 +295,95 @@ export const EdPropInstanceOptions: FC<{ ` )} > - +
+ {Array.isArray(local.options) && + local.options.map((item, idx) => { + const val: any[] = Array.isArray(evalue) + ? evalue + : []; + const found = val.find((e) => { + if (!item.options) { + return e === item.value; + } else { + if ( + typeof e === "object" && + e.value === item.value + ) { + return true; + } + return false; + } + }); + return ( + + { + onChange(JSON.stringify(val), item); + local.render(); + }} + /> + {item.options && + found && + item.options.map((child, idx) => { + const sub_found = found.checked.find( + (e: any) => { + if (!item.options) { + return e === child.value; + } else { + if ( + typeof e === "object" && + e.value === child.value + ) { + return true; + } + return false; + } + } + ); + return ( + + { + onChange(JSON.stringify(val), child); + local.render(); + }} + /> + {child.options && + sub_found && + child.options.map((item, sidx) => { + return ( + { + onChange( + JSON.stringify(val), + item + ); + local.render(); + }} + /> + ); + })} + + ); + })} + + ); + })} +
} asChild @@ -344,25 +426,14 @@ const CheckboxLayer = ({ render, evalue, onChange, - depth, }: { value: MetaOption[]; render: () => void; onChange: (val: string, item: MetaOption | undefined) => void; evalue: Array; - depth: number; }) => { return ( -
+
{Array.isArray(value) && value.map((item, idx) => { const val: any[] = Array.isArray(evalue) ? evalue : []; @@ -382,7 +453,7 @@ const CheckboxLayer = ({ item={item} idx={idx} val={val} - depth={depth} + depth={0} onChange={(val) => { onChange(JSON.stringify(val), item); render(); @@ -394,7 +465,6 @@ const CheckboxLayer = ({ render={render} evalue={found.checked} onChange={onChange} - depth={depth + 1} /> )}