diff --git a/public/metamodel/dochub/entities/aspects/base.yaml b/public/metamodel/dochub/entities/aspects/base.yaml index 158d2104..9126b26f 100644 --- a/public/metamodel/dochub/entities/aspects/base.yaml +++ b/public/metamodel/dochub/entities/aspects/base.yaml @@ -56,7 +56,7 @@ entities: }; $domains := $split($id, "."); $config.root_menu & "/" & $join($map($domains, function($domain, $index) {( - $lookup($aspects, $join($arrleft($domains, $index), ".")).title + $lookup($aspects, $join($arrleft($domains, $index), ".")).location )}), "/"); )}; [$append([{ @@ -70,4 +70,4 @@ entities: } )][location] )]; - ) \ No newline at end of file + ) diff --git a/src/frontend/components/JSONata/DevTool.vue b/src/frontend/components/JSONata/DevTool.vue index d3971011..f6fd4eb9 100644 --- a/src/frontend/components/JSONata/DevTool.vue +++ b/src/frontend/components/JSONata/DevTool.vue @@ -221,10 +221,10 @@ this.doAutoExecute(); }, refreshOrigins() { - const pipe = query.expression(`[(datasets.$spread().{ + const pipe = query.expression(`([datasets.$spread().{ "id": $keys()[0], "title": *.title - })]`, null, null, true, { log: this.log}); + }])`, null, null, true, { log: this.log}); pipe.evaluate().then((data) => this.origins = data); }, doAutoExecute() { diff --git a/src/global/manifest/parser.mjs b/src/global/manifest/parser.mjs index e80ff163..31f6ce96 100644 --- a/src/global/manifest/parser.mjs +++ b/src/global/manifest/parser.mjs @@ -57,6 +57,23 @@ const sectionDeepLog = { '$default$': 2 }; +// Получает глубину секции из конфигурации или использует значение по умолчанию +function getSectionDeepLog(section, manifest) { + // Сначала проверяем статические значения из sectionDeepLog + if (sectionDeepLog[section] !== undefined) { + return sectionDeepLog[section]; + } + + // Проверяем, есть ли конфигурация merge_depth в метамодели сущности + // Это позволяет задавать глубину для пользовательских сущностей через config.merge_depth + if (manifest?.entities?.[section]?.config?.merge_depth !== undefined) { + return manifest.entities[section].config.merge_depth; + } + + // Возвращаем значение по умолчанию + return sectionDeepLog['$default$']; +} + const parser = { // Манифест перезагружен onReloaded: null, @@ -131,7 +148,11 @@ const parser = { // Сохраняет в карте склеивания данные pushToMergeMap(path, source, location) { const structPath = (path || '/').split('/'); - const storePath = structPath.slice(0, sectionDeepLog[structPath[1] || '$default$'] + 1).join('/'); + const section = structPath[1] || '$default$'; + // Используем функцию getSectionDeepLog для получения глубины секции + // Это позволяет учитывать как статические настройки, так и динамические из config.merge_depth + const depth = getSectionDeepLog(section, this.manifest); + const storePath = structPath.slice(0, depth + 1).join('/'); let locations = this.mergeMap[storePath];