custom files: any DF parent path at any depth (v2.2.11)

The parent field was a select over custom DFs only, so a standard DF (e.g.
MF/7F20) could not be a parent and canonical entries under one were dropped
on import. It is now a free-text path with suggestions from the root, custom
DFs and DFs of the loaded tree (any depth); a bare FID chain is completed
from the root selector. Validation accepts standard or not-yet-seen parents
(flagged in the list), rejects a parent known to be an EF, and import keeps
such entries. Custom-file edits re-inject the loaded tree: new nodes appear
at once, renamed model nodes are restored and injected nodes removed when
their entry goes away. Help updated (the form lives in Profiler, not Card
reader). SW cache otaman-v176.
This commit is contained in:
2026-09-16 23:47:30 +03:00
parent 0698c9e90c
commit b0b8d02fe7
8 changed files with 255 additions and 54 deletions
+25 -2
View File
@@ -21,10 +21,11 @@ function extractFunc(src, name) {
return src.slice(m.index, i + 1);
}
let code = 'var pysimCustomFiles = [];\n';
for (const fn of ['pysimFsNodePath', 'pysimCustomInject', 'pysimCustomParent', 'pysimCustomFid']) {
let code = 'var pysimCustomFiles = [];\nvar pysimFsTreeRoot = null;\n';
for (const fn of ['pysimFsNodePath', 'pysimCustomInject', 'pysimCustomRefreshTree', 'pysimCustomParent', 'pysimCustomFid']) {
code += extractFunc(html, fn) + '\n';
}
code += 'globalThis.pysimFsRenderTree = () => {};\n';
eval(code);
function node(name, fid, parent, children) {
@@ -100,3 +101,25 @@ test('injected DFs are directories and can host their own children', () => {
assert.strictEqual(df.children.length, 1);
assert.strictEqual(df.children[0].name, 'EF.UNDER-NEW');
});
test('refresh restores renamed model nodes and drops injected ones', () => {
const t = tree();
pysimFsTreeRoot = t.mf;
pysimCustomFiles = [{ path: 'MF/5F03/6F46', name: 'EF.RENAMED', kind: 'ef' }];
pysimCustomRefreshTree();
assert.strictEqual(t.dfC.children[0].name, 'EF.RENAMED');
assert.strictEqual(t.dfC.children[0].custom, true);
// deleting the entry brings the model name back
pysimCustomFiles = [];
pysimCustomRefreshTree();
assert.strictEqual(t.dfC.children[0].name, 'EF.X');
assert.ok(!t.dfC.children[0].custom);
assert.strictEqual(t.dfC.children[0].modelName, undefined);
// injected nodes disappear together with their entry
pysimCustomFiles = [{ path: 'MF/5F10', name: 'DF.NEW', kind: 'df' }];
pysimCustomRefreshTree();
assert.ok(t.mf.children.some(c => c.fid === '5F10'));
pysimCustomFiles = [];
pysimCustomRefreshTree();
assert.ok(!t.mf.children.some(c => c.fid === '5F10'));
});