fixing kedap kedip
This commit is contained in:
parent
2c40b191ef
commit
706996a5f1
File diff suppressed because one or more lines are too long
|
|
@ -22,7 +22,13 @@ export const nodeRender: NodeRender<IMeta> = (node, prm) => {
|
||||||
if (!node || !node.data) {
|
if (!node || !node.data) {
|
||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
const item = node.data?.item;
|
let item = node.data?.item;
|
||||||
|
|
||||||
|
if (!item.id && node.data?.mitem) {
|
||||||
|
node.data.item = node.data.mitem.toJSON() as any;
|
||||||
|
item = node.data.item;
|
||||||
|
}
|
||||||
|
|
||||||
const isComponent = item.type === "item" && item.component?.id;
|
const isComponent = item.type === "item" && item.component?.id;
|
||||||
|
|
||||||
if (p.ui.tree.item_loading.includes(item.id)) {
|
if (p.ui.tree.item_loading.includes(item.id)) {
|
||||||
|
|
@ -71,7 +77,7 @@ export const nodeRender: NodeRender<IMeta> = (node, prm) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hide) {
|
if (hide) {
|
||||||
return <></>;
|
return <>HIDE</>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,11 +66,14 @@ export const viParts = (
|
||||||
|
|
||||||
if (!meta) {
|
if (!meta) {
|
||||||
if (item.type === "item" && item.component?.id) {
|
if (item.type === "item" && item.component?.id) {
|
||||||
console.error(`Warning component ${item.name} - ${item.component.id} failed to load.`);
|
console.error(
|
||||||
|
`Warning component ${item.name} - ${item.component.id} failed to load.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ViRender
|
<ViRender
|
||||||
key={id}
|
key={id}
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,6 @@ export const ViRender: FC<{
|
||||||
</ErrorBox>
|
</ErrorBox>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ErrorBox meta={meta}>
|
<ErrorBox meta={meta}>
|
||||||
<ViChild
|
<ViChild
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ export const ViScript: FC<{
|
||||||
|
|
||||||
if (meta.item.adv?.js) {
|
if (meta.item.adv?.js) {
|
||||||
viEvalScript(vi, meta, is_layout, _pass, depth, parent_key);
|
viEvalScript(vi, meta, is_layout, _pass, depth, parent_key);
|
||||||
|
|
||||||
if (meta.script) return meta.script.result;
|
if (meta.script) return meta.script.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ export const viEvalScript = (
|
||||||
|
|
||||||
const script = meta.script;
|
const script = meta.script;
|
||||||
const exports = (window as any).exports;
|
const exports = (window as any).exports;
|
||||||
|
|
||||||
const arg = {
|
const arg = {
|
||||||
useEffect,
|
useEffect,
|
||||||
children: parts.props.children,
|
children: parts.props.children,
|
||||||
|
|
@ -78,7 +79,7 @@ export const viEvalScript = (
|
||||||
el: ReactElement;
|
el: ReactElement;
|
||||||
} => {
|
} => {
|
||||||
let should_replace = false;
|
let should_replace = false;
|
||||||
const new_childs = [];
|
let new_childs = [];
|
||||||
|
|
||||||
if (isValidElement(el)) {
|
if (isValidElement(el)) {
|
||||||
if (el.type === meta.script?.PassProp) {
|
if (el.type === meta.script?.PassProp) {
|
||||||
|
|
@ -90,8 +91,13 @@ export const viEvalScript = (
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Array.isArray(el.props?.children)) {
|
|
||||||
for (const child of el.props?.children) {
|
if (el.props?.children) {
|
||||||
|
if (!Array.isArray(el.props.children)) {
|
||||||
|
el.props.children = [el.props.children];
|
||||||
|
}
|
||||||
|
if (Array.isArray(el.props.children)) {
|
||||||
|
for (const child of el.props.children) {
|
||||||
if (Array.isArray(child)) {
|
if (Array.isArray(child)) {
|
||||||
const sub_child = [];
|
const sub_child = [];
|
||||||
let sub_replace = false;
|
let sub_replace = false;
|
||||||
|
|
@ -115,7 +121,10 @@ export const viEvalScript = (
|
||||||
should_replace = true;
|
should_replace = true;
|
||||||
new_childs.push({
|
new_childs.push({
|
||||||
...child,
|
...child,
|
||||||
props: { ...child.props, internal_key: child.props.key },
|
props: {
|
||||||
|
...child.props,
|
||||||
|
internal_key: child.props.key,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -124,6 +133,7 @@ export const viEvalScript = (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
should_replace,
|
should_replace,
|
||||||
|
|
@ -136,6 +146,7 @@ export const viEvalScript = (
|
||||||
result = res.el;
|
result = res.el;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (script) script.result = <Suspense>{result}</Suspense>;
|
if (script) script.result = <Suspense>{result}</Suspense>;
|
||||||
},
|
},
|
||||||
params,
|
params,
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { IMeta } from "../../../ed/logic/ed-global";
|
||||||
import { VG } from "../global";
|
import { VG } from "../global";
|
||||||
import { modifyChild } from "./passprop";
|
import { modifyChild } from "./passprop";
|
||||||
import { deepClone } from "web-utils";
|
import { deepClone } from "web-utils";
|
||||||
|
import { w } from "./eval-prop";
|
||||||
|
|
||||||
export const local_cached_value = {} as Record<
|
export const local_cached_value = {} as Record<
|
||||||
string,
|
string,
|
||||||
|
|
@ -45,12 +46,14 @@ export const createViLocal = (
|
||||||
if (!local_cached_value[curid]) {
|
if (!local_cached_value[curid]) {
|
||||||
local_cached_value[curid] = { mounted: true, value: arg.value };
|
local_cached_value[curid] = { mounted: true, value: arg.value };
|
||||||
} else if (!local_cached_value[curid].mounted) {
|
} else if (!local_cached_value[curid].mounted) {
|
||||||
|
if (!w.isEditor) {
|
||||||
for (const [k, v] of Object.entries(local_cached_value[curid].value)) {
|
for (const [k, v] of Object.entries(local_cached_value[curid].value)) {
|
||||||
delete local_cached_value[curid].value[k];
|
delete local_cached_value[curid].value[k];
|
||||||
}
|
}
|
||||||
for (const [k, v] of Object.entries(deepClone(arg.value))) {
|
for (const [k, v] of Object.entries(deepClone(arg.value))) {
|
||||||
local_cached_value[curid].value[k] = v;
|
local_cached_value[curid].value[k] = v;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
local_cached_value[curid].mounted = true;
|
local_cached_value[curid].mounted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue