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,8 +47,26 @@ export const EdSidePropInstance: FC<{ meta: IMeta }> = ({ meta }) => {
const cprop = m.toJSON() as any;
const type = m.get("meta")?.get("type") || "text";
const visible = mprop?.get("visible") || "";
if (visible) {
return;
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;
}
} catch (e) {
}
}
if (!local.showJSX && type === "content-element") {

View File

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

View File

@ -94,7 +94,7 @@ export const viEvalProps = (
return null;
},
};
arg[name] = val;
if (passprop) {