fix find by id
This commit is contained in:
parent
0ea9a29eac
commit
9a4f026196
|
|
@ -37,7 +37,7 @@ export const router = {
|
||||||
${[...imports].map((e) => `${e.replace(/\W/g, "_")}`).join(",\n ")}
|
${[...imports].map((e) => `${e.replace(/\W/g, "_")}`).join(",\n ")}
|
||||||
}
|
}
|
||||||
`.trim();
|
`.trim();
|
||||||
content = `// AUTOGENERATED - DO NOT EDIT //\n\n${content}`;
|
content = `/** AUTOGENERATED - DO NOT EDIT **/\n\n${content}`;
|
||||||
|
|
||||||
const hash = simpleHash(content);
|
const hash = simpleHash(content);
|
||||||
const router = Bun.file(
|
const router = Bun.file(
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export const EdTreeSearch = () => {
|
||||||
focus: false,
|
focus: false,
|
||||||
hover: false,
|
hover: false,
|
||||||
cursor: null as number | null,
|
cursor: null as number | null,
|
||||||
search_timeout: null as any
|
search_timeout: null as any,
|
||||||
});
|
});
|
||||||
|
|
||||||
p.ui.tree.search_ref = local.sref;
|
p.ui.tree.search_ref = local.sref;
|
||||||
|
|
@ -122,13 +122,20 @@ export const doTreeSearch = (p: PG) => {
|
||||||
ptree = p.comp.list[active.comp_id].tree;
|
ptree = p.comp.list[active.comp_id].tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
const comp_searched = new Set<string>()
|
const comp_searched = new Set<string>();
|
||||||
|
|
||||||
const searchInPTree = (ptree: NodeModel<IMeta>[], id_component?: string) => {
|
const searchInPTree = (ptree: NodeModel<IMeta>[], id_component?: string) => {
|
||||||
if (p.ui.tree.search_mode.Name) {
|
if (p.ui.tree.search_mode.Name) {
|
||||||
const found = fuzzy(ptree, "text", search);
|
const found = fuzzy(ptree, "text", search);
|
||||||
|
|
||||||
|
const id_found = ptree.find((e) => e.id === search);
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
|
if (id_found) {
|
||||||
|
tree[id_found.id] = { idx: 0, node: { ...id_found, parent: "root" } };
|
||||||
|
i = 1;
|
||||||
|
}
|
||||||
|
|
||||||
for (const row of found) {
|
for (const row of found) {
|
||||||
if (row.data) {
|
if (row.data) {
|
||||||
if (id_component && row.data.parent)
|
if (id_component && row.data.parent)
|
||||||
|
|
@ -183,7 +190,7 @@ export const doTreeSearch = (p: PG) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
searchInPTree(ptree);
|
searchInPTree(ptree);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue