fix 3 deep level prop option

This commit is contained in:
Rizky 2024-04-16 18:56:31 +07:00
parent 78834f5887
commit c49097fa0a
1 changed files with 46 additions and 13 deletions

View File

@ -286,7 +286,21 @@ export const EdPropInstanceOptions: FC<{
item.options.map((child, idx) => {
let checked: any[] = found.checked;
const sub_found = checked.find((e) => {
if (!item.options) {
return e === child.value;
} else {
if (
typeof e === "object" &&
e.value === child.value
) {
return true;
}
return false;
}
});
return (
<Fragment key={idx}>
<SingleCheckbox
key={idx}
item={child}
@ -295,11 +309,30 @@ export const EdPropInstanceOptions: FC<{
val={checked}
onChange={(newval) => {
found.checked = newval;
onChange(JSON.stringify(val), child);
local.render();
}}
/>
{child.options &&
sub_found &&
child.options.map((item, sidx) => {
const checked: any[] = sub_found.checked;
return (
<SingleCheckbox
item={item}
idx={idx}
key={sidx}
depth={2}
val={checked}
onChange={(newval) => {
sub_found.checked = newval;
onChange(JSON.stringify(val), item);
local.render();
}}
/>
);
})}
</Fragment>
);
})}
</Fragment>