wip
This commit is contained in:
parent
bd586ce347
commit
cdb613651c
|
|
@ -41,8 +41,8 @@ export const declareScope = async (
|
||||||
map_childs(metas, entry, paths);
|
map_childs(metas, entry, paths);
|
||||||
const added = new Set<string>();
|
const added = new Set<string>();
|
||||||
for (const path of paths) {
|
for (const path of paths) {
|
||||||
|
console.log(path.map((e) => e.item.name));
|
||||||
const exim = scopeMapExportImport(p, meta, path);
|
const exim = scopeMapExportImport(p, meta, path);
|
||||||
|
|
||||||
for (const [k, v] of Object.entries(exim.exports)) {
|
for (const [k, v] of Object.entries(exim.exports)) {
|
||||||
for (const [filename, src] of Object.entries(v)) {
|
for (const [filename, src] of Object.entries(v)) {
|
||||||
if (!added.has(filename)) {
|
if (!added.has(filename)) {
|
||||||
|
|
@ -64,31 +64,34 @@ const map_childs = (
|
||||||
for (const m of childs) {
|
for (const m of childs) {
|
||||||
const meta = metas[m.id];
|
const meta = metas[m.id];
|
||||||
if (meta) {
|
if (meta) {
|
||||||
let cur: null | IMeta[] = null;
|
|
||||||
for (const path of paths) {
|
|
||||||
if (path[path.length - 1] === parent) {
|
|
||||||
cur = path;
|
|
||||||
cur.push(meta);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cur) {
|
|
||||||
paths.push([...(curpath || []), meta]);
|
paths.push([...(curpath || []), meta]);
|
||||||
cur = paths[paths.length - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cur) {
|
|
||||||
if (
|
if (
|
||||||
meta.item.type === "item" &&
|
meta.item.type === "item" &&
|
||||||
meta.item.component?.id &&
|
meta.item.component?.id &&
|
||||||
meta.item.component?.id !== active.comp_id
|
meta.item.component?.id !== active.comp_id
|
||||||
) {
|
) {
|
||||||
continue;
|
if (meta.item.component?.props) {
|
||||||
|
for (const [_, p] of Object.entries(meta.item.component.props)) {
|
||||||
|
if (p.meta?.type === "content-element" && p.content) {
|
||||||
|
map_childs(
|
||||||
|
metas,
|
||||||
|
[p.content],
|
||||||
|
paths,
|
||||||
|
[...(curpath || []), meta],
|
||||||
|
meta
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Array.isArray(meta.item.childs)) {
|
if (Array.isArray(meta.item.childs)) {
|
||||||
map_childs(metas, meta.item.childs, paths, cur, meta);
|
map_childs(
|
||||||
}
|
metas,
|
||||||
|
meta.item.childs,
|
||||||
|
paths,
|
||||||
|
[...(curpath || []), meta],
|
||||||
|
meta
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,6 @@ export const edActionDeleteById = async (p: PG, id: string) => {
|
||||||
|
|
||||||
const deleteByParent = (p: PG, mitem: MItem, index: number) => {
|
const deleteByParent = (p: PG, mitem: MItem, index: number) => {
|
||||||
const mchild = mitem.parent.get(index);
|
const mchild = mitem.parent.get(index);
|
||||||
const child = mchild?.toJSON() as IItem;
|
|
||||||
|
|
||||||
console.log(child);
|
|
||||||
mitem.parent.delete(index);
|
mitem.parent.delete(index);
|
||||||
treeRebuild(p);
|
treeRebuild(p);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue