feat(form-decompile,form-compile): ToolTip companion ExtendedTooltip (подсказка расширенной подсказки)

Companion <ExtendedTooltip> (это LabelDecoration) может нести собственный <ToolTip> —
реальный текст подсказки (ML), а не пустой Title. Декомпилятор ловил Title/layout/flags/
events компаньона, но НЕ его ToolTip → реальный двуязычный текст молча терялся (форма
ВводОстатков/ФормаТовары: расширенная подсказка ЕдиницаИзмеренияТНВЭД).

DSL: extendedTooltip.tooltip (ML-текст). Декомпилятор: захват <lf:ToolTip> компаньона
(Get-LangText). Компилятор (ps1+py): tooltip в companionStructKeys + эмит <ToolTip> после
Title (порядок схемы LabelDecoration). ≠ элементного tooltip обычной подсказки —
скоупится вложенностью (могут сосуществовать).

Редкое (1 форма в rt-iter), но реальная потеря контента. Форма ВводОстатков → match.
Кейс input-fields (ОбычноеПоле: элементный tooltip + extendedTooltip с text+tooltip+events)
сертифицирован загрузкой в 1С — оба tooltip сосуществуют. Регресс 43/43, ps1==py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-06-12 21:26:15 +03:00
parent abcd5be2b0
commit 03b2b5a64e
6 changed files with 25 additions and 7 deletions
@@ -1,4 +1,4 @@
# form-compile v1.143 — Compile 1C managed form from JSON or object metadata
# form-compile v1.144 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$JsonPath,
@@ -2547,7 +2547,7 @@ function Emit-Events {
$script:companionStructKeys = @(
'width','autoMaxWidth','maxWidth','height','autoMaxHeight','maxHeight','verticalAlign','titleHeight',
'horizontalStretch','verticalStretch','horizontalAlign','groupHorizontalAlign','groupVerticalAlign',
'visible','hidden','enabled','disabled','hyperlink','events',
'visible','hidden','enabled','disabled','hyperlink','events','tooltip',
'textColor','backColor','borderColor','font','border','цветтекста','цветфона','цветрамки','шрифт','рамка'
)
function Test-CompanionStructured {
@@ -2596,6 +2596,8 @@ function Emit-Companion {
Emit-Layout -el $content -indent $inner
Emit-Appearance -el $content -indent $inner -profile 'decoration'
if ($txtPresent) { Emit-CompanionTitle -content $content -indent $inner }
# ToolTip компаньона (подсказка самой расширенной подсказки) — после Title (порядок схемы LabelDecoration)
if ($content.tooltip) { Emit-MLText -tag "ToolTip" -text $content.tooltip -indent $inner }
# События компаньона (ExtendedTooltip = LabelDecoration: напр. URLProcessing у hyperlink-подсказки)
Emit-Events -el $content -elementName $name -indent $inner -typeKey 'label'
} else {
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# form-compile v1.143 — Compile 1C managed form from JSON or object metadata
# form-compile v1.144 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import copy
@@ -2586,7 +2586,7 @@ def resolve_ml_formatted(val):
COMPANION_STRUCT_KEYS = {
'width', 'autoMaxWidth', 'maxWidth', 'height', 'autoMaxHeight', 'maxHeight', 'verticalAlign', 'titleHeight',
'horizontalStretch', 'verticalStretch', 'horizontalAlign', 'groupHorizontalAlign', 'groupVerticalAlign',
'visible', 'hidden', 'enabled', 'disabled', 'hyperlink', 'events',
'visible', 'hidden', 'enabled', 'disabled', 'hyperlink', 'events', 'tooltip',
'textColor', 'backColor', 'borderColor', 'font', 'border', 'цветтекста', 'цветфона', 'цветрамки', 'шрифт', 'рамка',
}
@@ -2615,6 +2615,9 @@ def emit_companion(lines, tag, name, indent, content=None):
emit_appearance(lines, content, inner, 'decoration')
if 'text' in content:
emit_companion_title(lines, content, inner)
# ToolTip компаньона (подсказка самой расширенной подсказки) — после Title (порядок схемы LabelDecoration)
if content.get('tooltip'):
emit_mltext(lines, inner, 'ToolTip', content['tooltip'])
# События компаньона (ExtendedTooltip = LabelDecoration: напр. URLProcessing у hyperlink-подсказки)
emit_events(lines, content, name, inner, 'label')
else:
@@ -1,4 +1,4 @@
# form-decompile v0.116 — Decompile 1C managed Form.xml to JSON DSL (draft)
# form-decompile v0.117 — Decompile 1C managed Form.xml to JSON DSL (draft)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
param(
@@ -2124,6 +2124,9 @@ function Decompile-Element {
Add-Layout $etObj $etNode
Add-GenericScalars $etObj $etNode
Add-Appearance $etObj $etNode
# ToolTip самого компаньона (подсказка расширенной подсказки) — реальный текст (ML), не пустой Title
$etTT = $etNode.SelectSingleNode("lf:ToolTip", $ns)
if ($etTT) { $ttVal = Get-LangText $etTT; if ($null -ne $ttVal) { $etObj['tooltip'] = $ttVal } }
if ((Get-Child $etNode 'Visible') -eq 'false') { $etObj['hidden'] = $true }
if ((Get-Child $etNode 'Enabled') -eq 'false') { $etObj['disabled'] = $true }
if ((Get-Child $etNode 'Hyperlink') -eq 'true') { $etObj['hyperlink'] = $true }