balik
This commit is contained in:
parent
634adaeef8
commit
d571700f32
|
|
@ -295,12 +295,95 @@ export const EdPropInstanceOptions: FC<{
|
||||||
`
|
`
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<CheckboxLayer
|
<div className={cx("flex flex-col bg-white")}>
|
||||||
value={local.options}
|
{Array.isArray(local.options) &&
|
||||||
render={local.render}
|
local.options.map((item, idx) => {
|
||||||
evalue={evalue}
|
const val: any[] = Array.isArray(evalue)
|
||||||
onChange={onChange}
|
? 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 (
|
||||||
|
<Fragment key={idx}>
|
||||||
|
<SingleCheckbox
|
||||||
|
item={item}
|
||||||
|
idx={idx}
|
||||||
|
val={val}
|
||||||
|
depth={0}
|
||||||
|
onChange={(val) => {
|
||||||
|
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 (
|
||||||
|
<Fragment key={idx}>
|
||||||
|
<SingleCheckbox
|
||||||
|
key={idx}
|
||||||
|
item={child}
|
||||||
|
idx={idx}
|
||||||
|
depth={1}
|
||||||
|
val={found.checked}
|
||||||
|
onChange={(newval) => {
|
||||||
|
onChange(JSON.stringify(val), child);
|
||||||
|
local.render();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{child.options &&
|
||||||
|
sub_found &&
|
||||||
|
child.options.map((item, sidx) => {
|
||||||
|
return (
|
||||||
|
<SingleCheckbox
|
||||||
|
item={item}
|
||||||
|
idx={idx}
|
||||||
|
key={sidx}
|
||||||
|
depth={2}
|
||||||
|
val={sub_found.checked}
|
||||||
|
onChange={(newval) => {
|
||||||
|
onChange(
|
||||||
|
JSON.stringify(val),
|
||||||
|
item
|
||||||
|
);
|
||||||
|
local.render();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
asChild
|
asChild
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue