wip fix
This commit is contained in:
parent
4e8f21eb1e
commit
269de30f24
|
|
@ -2,6 +2,7 @@ import { NodeModel, RenderParams } from "@minoru/react-dnd-treeview";
|
||||||
import { FC, useEffect } from "react";
|
import { FC, useEffect } from "react";
|
||||||
import { useGlobal, useLocal } from "web-utils";
|
import { useGlobal, useLocal } from "web-utils";
|
||||||
import { EDGlobal, EdMeta } from "../../../../logic/ed-global";
|
import { EDGlobal, EdMeta } from "../../../../logic/ed-global";
|
||||||
|
import { Tooltip } from "../../../../../../utils/ui/tooltip";
|
||||||
|
|
||||||
export const EdTreeName = ({
|
export const EdTreeName = ({
|
||||||
node,
|
node,
|
||||||
|
|
@ -88,9 +89,12 @@ const Name: FC<{ name: string; is_jsx_prop: boolean }> = ({
|
||||||
if (is_jsx_prop) {
|
if (is_jsx_prop) {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center space-x-1">
|
<div className="flex items-center space-x-1">
|
||||||
<div className="flex text-purple-500 border border-purple-400 items-center justify-center font-mono text-[6px] px-[2px]">
|
<Tooltip
|
||||||
|
content={`Type: JSX Prop`}
|
||||||
|
className="flex text-purple-500 border border-purple-400 items-center justify-center font-mono text-[6px] px-[2px]"
|
||||||
|
>
|
||||||
P
|
P
|
||||||
</div>
|
</Tooltip>
|
||||||
<div>{name}</div>
|
<div>{name}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,14 @@ import { NodeRender } from "@minoru/react-dnd-treeview";
|
||||||
import { useGlobal, useLocal } from "web-utils";
|
import { useGlobal, useLocal } from "web-utils";
|
||||||
import { Loading } from "../../../../../utils/ui/loading";
|
import { Loading } from "../../../../../utils/ui/loading";
|
||||||
import { EDGlobal, EdMeta, active } from "../../../logic/ed-global";
|
import { EDGlobal, EdMeta, active } from "../../../logic/ed-global";
|
||||||
|
import { getMetaById } from "../../../logic/tree/build";
|
||||||
import { EdTreeAction } from "./item/action";
|
import { EdTreeAction } from "./item/action";
|
||||||
import { EdTreeCtxMenu } from "./item/ctx-menu";
|
import { EdTreeCtxMenu } from "./item/ctx-menu";
|
||||||
import { EdTreeIndent } from "./item/indent";
|
import { EdTreeIndent } from "./item/indent";
|
||||||
import { EdTreeName } from "./item/name";
|
import { EdTreeName } from "./item/name";
|
||||||
import { treeItemKeyMap } from "./key-map";
|
import { treeItemKeyMap } from "./key-map";
|
||||||
import { useEffect } from "react";
|
|
||||||
import { getMetaById } from "../../../logic/tree/build";
|
const jsxPropLoadingRender = {} as Record<string, string>;
|
||||||
|
|
||||||
export const nodeRender: NodeRender<EdMeta> = (node, prm) => {
|
export const nodeRender: NodeRender<EdMeta> = (node, prm) => {
|
||||||
const p = useGlobal(EDGlobal, "EDITOR");
|
const p = useGlobal(EDGlobal, "EDITOR");
|
||||||
|
|
@ -27,6 +28,29 @@ export const nodeRender: NodeRender<EdMeta> = (node, prm) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node.data?.jsx_prop_name) {
|
||||||
|
const meta = getMetaById(p, node.data?.parent_item.id);
|
||||||
|
if (meta) {
|
||||||
|
if (meta.propvis) {
|
||||||
|
if (meta.propvis[node.data.jsx_prop_name] === false) return <></>;
|
||||||
|
} else {
|
||||||
|
if (!jsxPropLoadingRender[meta.item.id]) {
|
||||||
|
jsxPropLoadingRender[meta.item.id] = node.data.jsx_prop_name;
|
||||||
|
}
|
||||||
|
if (jsxPropLoadingRender[meta.item.id] === node.data.jsx_prop_name) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={"relative border-b flex items-stretch min-h-[26px]"}
|
||||||
|
>
|
||||||
|
<Loading backdrop={false} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return <></>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={(el) => {
|
ref={(el) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue