This commit is contained in:
Rizky 2024-01-30 19:32:44 +07:00
parent c38f2a1da5
commit 4e818ae458
3 changed files with 32 additions and 8 deletions

View File

@ -47,9 +47,27 @@ export const EdSidePropInstance: FC<{ meta: IMeta }> = ({ meta }) => {
const cprop = m.toJSON() as any; const cprop = m.toJSON() as any;
const type = m.get("meta")?.get("type") || "text"; const type = m.get("meta")?.get("type") || "text";
const visible = mprop?.get("visible") || ""; const visible = mprop?.get("visible") || "";
if (visible) {
if (visible && visible !== "true") {
try {
const arg: any = {};
if (meta.item.script?.props) {
for (const [k, v] of Object.entries(meta.item.script?.props)) {
eval(`arg.${k} = ${v.value}`);
}
}
const visible_fn = new Function(
...Object.keys(arg),
`return ${visible}`
);
const res = visible_fn(...Object.values(arg));
if (!res) {
return; return;
} }
} catch (e) {
}
}
if (!local.showJSX && type === "content-element") { if (!local.showJSX && type === "content-element") {
return; return;

View File

@ -34,17 +34,23 @@ export const EdTreeSearch = () => {
local.render(); local.render();
}} }}
> >
<div className="flex items-stretch h-[24px] "> <form
className="flex items-stretch h-[24px] "
autoComplete="off"
onSubmit={(e) => {
e.preventDefault();
}}
>
<input <input
name="search-tree" name="search-tree-prasi"
ref={(ref) => { ref={(ref) => {
local.sref = ref; local.sref = ref;
}} }}
type="search" type="search"
autoComplete="off" autoComplete="new-password"
className={cx("flex-1 outline-none px-2 text-[13px] ")} className={cx("flex-1 outline-none px-2 text-[13px] ")}
placeholder="Search..." placeholder="Search..."
value={p.ui.tree.search} value={p.ui.tree.search || ""}
spellCheck={false} spellCheck={false}
onInput={(e) => { onInput={(e) => {
local.cursor = e.currentTarget.selectionStart; local.cursor = e.currentTarget.selectionStart;
@ -70,7 +76,7 @@ export const EdTreeSearch = () => {
} }
}} }}
/> />
</div> </form>
{(local.focus || local.hover || p.ui.tree.search) && ( {(local.focus || local.hover || p.ui.tree.search) && (
<div className="p-1 bg-white text-xs border-t flex space-x-1 justify-between"> <div className="p-1 bg-white text-xs border-t flex space-x-1 justify-between">
<div className="flex space-x-1"> <div className="flex space-x-1">