wip fix component
This commit is contained in:
parent
acf29cea84
commit
a78877d78d
|
|
@ -6,7 +6,7 @@ export const comp_group: SAction["comp"]["group"] = async function (
|
|||
id_site
|
||||
) {
|
||||
const result: Awaited<ReturnType<SAction["comp"]["group"]>> = {};
|
||||
const groups = await db.component_group.findMany({
|
||||
let groups = await db.component_group.findMany({
|
||||
where: {
|
||||
component_site: {
|
||||
some: {
|
||||
|
|
@ -20,6 +20,46 @@ export const comp_group: SAction["comp"]["group"] = async function (
|
|||
},
|
||||
});
|
||||
|
||||
if (groups.length === 0) {
|
||||
await db.component_group.create({
|
||||
data: {
|
||||
name: "All",
|
||||
component_site: {
|
||||
create: {
|
||||
id_site,
|
||||
is_owner: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await db.component_group.create({
|
||||
data: {
|
||||
name: "__TRASH__",
|
||||
component_site: {
|
||||
create: {
|
||||
id_site,
|
||||
is_owner: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
groups = await db.component_group.findMany({
|
||||
where: {
|
||||
component_site: {
|
||||
some: {
|
||||
id_site,
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
name: true,
|
||||
id: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
for (const g of groups) {
|
||||
result[g.id] = {
|
||||
id: g.id,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ export const EdPopCompGroup = () => {
|
|||
if (!p.ui.popup.comp_group) return null;
|
||||
const pop = p.ui.popup.comp_group;
|
||||
const group = p.comp.group[p.site.id];
|
||||
|
||||
return (
|
||||
<Menu
|
||||
mouseEvent={pop.mouse_event}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { FC, ReactNode } from "react";
|
|||
import { useGlobal, useLocal } from "web-utils";
|
||||
import { EDGlobal, active } from "../../../logic/ed-global";
|
||||
import { compPicker, reloadCompPicker } from "./comp-reload";
|
||||
import { treeRebuild } from "../../../logic/tree/build";
|
||||
|
||||
export type CompItem = {
|
||||
id: string;
|
||||
|
|
@ -140,6 +141,7 @@ export const edPageTreeRender: NodeRender<CompItem> = (
|
|||
data: { id_component_group: group_id },
|
||||
});
|
||||
await reloadCompPicker(p);
|
||||
treeRebuild(p);
|
||||
p.render();
|
||||
},
|
||||
};
|
||||
|
|
@ -151,8 +153,8 @@ export const edPageTreeRender: NodeRender<CompItem> = (
|
|||
p.ui.popup.comp.open = null;
|
||||
active.item_id = compPicker.active_id;
|
||||
compPicker.active_id = "";
|
||||
|
||||
p.page.render();
|
||||
treeRebuild(p);
|
||||
p.render();
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -5,15 +5,18 @@ import {
|
|||
useEffect,
|
||||
useRef,
|
||||
} from "react";
|
||||
import { useLocal } from "web-utils";
|
||||
import { useGlobal, useLocal } from "web-utils";
|
||||
import { FMCompDef } from "../../../../../utils/types/meta-fn";
|
||||
import { EdPropLabel } from "./prop-label";
|
||||
import { treeRebuild } from "../../../logic/tree/build";
|
||||
import { EDGlobal } from "../../../logic/ed-global";
|
||||
|
||||
export const EdPropInstanceText: FC<{
|
||||
name: string;
|
||||
mprop: FMCompDef;
|
||||
labelClick?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
||||
}> = ({ name, mprop, labelClick }) => {
|
||||
const p = useGlobal(EDGlobal, "EDITOR");
|
||||
const val = mprop.get("value");
|
||||
|
||||
const local = useLocal({
|
||||
|
|
@ -43,7 +46,9 @@ export const EdPropInstanceText: FC<{
|
|||
mprop.set("value", `\`${local.value}\``);
|
||||
mprop.set("valueBuilt", `\`${local.value}\``);
|
||||
});
|
||||
}, 1000);
|
||||
treeRebuild(p);
|
||||
p.render();
|
||||
}, 200);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue