mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-20 09:30:59 +03:00
fix(form-compile): companion наследовал DisplayImportance владельца (PowerShell dynamic scope)
Emit-Companion / Emit-CompanionPanel вызывали DI-Attr $el, но $el НЕ их параметр — PowerShell брал его из родительского скоупа (эмитируемого элемента). Поэтому авто-генерируемые companion (ExtendedTooltip/ContextMenu/AutoCommandBar с name="@") наследовали DisplayImportance владельца (CheckBoxField/UsualGroup/Table), которого в оригинале у них нет → ложный ADDED. Корпус: ExtendedTooltip/ContextMenu НИКОГДА не несут DisplayImportance, AutoCommandBar — только element-level (11), не companion. Фикс: DI-Attr от СОБСТВЕННОГО объекта компаньона ($content / $panel), не от ambient $el. Python не имел dynamic-scope-бага (di_attr на companion не эмитил вовсе), но для паритета добавлен di_attr(content/panel) — оба рантайма теперь идентичны (companion без собственного DI → пусто). Выборка 19 форм (СостоянияОригиналовПервичныхДокументов acc+erp, + формы с DisplayImportance-владельцами): match 18, ADDED DisplayImportance исчез. ps1==py байт-в-байт. Регресс 43/43. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
e1fb40189c
commit
90d2649a5f
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# form-compile v1.159 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.160 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import copy
|
||||
@@ -2628,7 +2628,8 @@ def emit_companion(lines, tag, name, indent, content=None):
|
||||
lines.append(f'{indent}<{tag} name="{name}" id="{cid}"/>')
|
||||
return
|
||||
inner = f'{indent}\t'
|
||||
lines.append(f'{indent}<{tag} name="{name}" id="{cid}">')
|
||||
# DI-Attr от собственного объекта компаньона (не от владельца) — зеркало ps1
|
||||
lines.append(f'{indent}<{tag} name="{name}" id="{cid}"{di_attr(content if isinstance(content, dict) else None)}>')
|
||||
if isinstance(content, dict) and any(k in content for k in COMPANION_STRUCT_KEYS):
|
||||
# own-content ПЕРЕД Title (в корпусе layout-first 582 vs 10).
|
||||
emit_common_flags(lines, content, inner)
|
||||
@@ -2669,7 +2670,7 @@ def emit_companion_panel(lines, tag, name, indent, panel):
|
||||
if not emit_af_false and not has_children and not halign:
|
||||
lines.append(f'{indent}<{tag} name="{name}" id="{cid}"/>')
|
||||
return
|
||||
lines.append(f'{indent}<{tag} name="{name}" id="{cid}">')
|
||||
lines.append(f'{indent}<{tag} name="{name}" id="{cid}"{di_attr(panel if isinstance(panel, dict) else None)}>')
|
||||
if halign:
|
||||
lines.append(f'{indent}\t<HorizontalAlign>{halign}</HorizontalAlign>')
|
||||
if emit_af_false:
|
||||
|
||||
Reference in New Issue
Block a user