feat(form-decompile,form-compile): эмиссия оформления Page/Popup + ColumnGroup HeaderPicture + whitespace Title/ToolTip

Декомпилятор ловил эти свойства (Add-CommonProps/Add-Appearance), но эмиттеры
компилятора их не выводили → LOST. Четыре подфикса (по выбору пользователя из топа
list-iter):

1. Page>BackColor/TitleTextColor/TitleFont (193+): Emit-Page не звал Emit-Appearance.
   Добавлен (profile field, после ShowTitle перед компаньоном — порядок корпуса).
2. Popup>TitleTextColor/TitleFont (133/127): Emit-Popup не звал Emit-Appearance. Добавлен.
3. ColumnGroup>HeaderPicture (144): Emit-ColumnGroup не звал Emit-ColumnPics. Добавлен
   (после ShowInHeader/Layout перед оформлением — порядок корпуса).
4. UsualGroup Title/ToolTip с whitespace-контентом: Add-CommonProps читал title/tooltip
   через Get-LangText (PreserveWhitespace=false стрипал <v8:content> </> → "" →
   компилятор подавлял). Новый Get-LangTextWS восстанавливает " " (как Get-MLFormattedValue).
   1-пробельные tooltip'ы теперь матчатся; редкий N-пробельный → косметика числа пробелов.

Зеркало py. Выборка 40 форм с этими категориями: целевые потери 0 (match 21,
остаток — несвязанный хвост). Кейсы pages (+backColor/titleTextColor/titleFont),
column-group (+headerPicture), button-group (popup +titleTextColor/titleFont)
сертифицированы в 1С. Регресс 43/43 (ps1+py).

Раскрыто (отдельно): MultipleValuesBackColor (input) — другой appearance-ключ.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-06-11 20:04:09 +03:00
parent c96bcc3566
commit 32273d2be8
10 changed files with 49 additions and 10 deletions
@@ -1,4 +1,4 @@
# form-compile v1.119 — Compile 1C managed form from JSON or object metadata
# form-compile v1.120 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$JsonPath,
@@ -3555,6 +3555,9 @@ function Emit-ColumnGroup {
Emit-CommonFlags -el $el -indent $inner
Emit-Layout -el $el -indent $inner
# Картинка заголовка колонки-группы (после ShowInHeader/Layout, перед оформлением — порядок XSD)
Emit-ColumnPics -el $el -indent $inner
# Оформление (цвета/шрифты/граница) — перед компаньоном
Emit-Appearance -el $el -indent $inner -profile 'field'
@@ -4387,6 +4390,9 @@ function Emit-Page {
if ($el.showTitle -eq $false) { X "$inner<ShowTitle>false</ShowTitle>" }
Emit-Layout -el $el -indent $inner
# Оформление страницы (BackColor / TitleTextColor / TitleFont) — после ShowTitle, перед компаньоном
Emit-Appearance -el $el -indent $inner -profile 'field'
# Companion
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner -content $el.extendedTooltip
@@ -4753,6 +4759,10 @@ function Emit-Popup {
X "$inner<Representation>$($el.representation)</Representation>"
}
Emit-Layout -el $el -indent $inner
# Оформление попапа (TitleTextColor / TitleFont) — перед компаньоном
Emit-Appearance -el $el -indent $inner -profile 'field'
Emit-Companion -tag "ExtendedTooltip" -name "${name}РасширеннаяПодсказка" -indent $inner -content $el.extendedTooltip
# Children
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# form-compile v1.119 — Compile 1C managed form from JSON or object metadata
# form-compile v1.120 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import copy
@@ -3642,6 +3642,9 @@ def emit_column_group(lines, el, name, eid, indent):
emit_common_flags(lines, el, inner)
emit_layout(lines, el, inner)
# Картинка заголовка колонки-группы (после ShowInHeader/Layout, перед оформлением — порядок XSD)
emit_column_pics(lines, el, inner)
# Оформление (цвета/шрифты/граница) — перед компаньоном
emit_appearance(lines, el, inner, 'field')
@@ -4112,6 +4115,9 @@ def emit_page(lines, el, name, eid, indent):
lines.append(f'{inner}<ShowTitle>false</ShowTitle>')
emit_layout(lines, el, inner)
# \u041e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b (BackColor / TitleTextColor / TitleFont) \u2014 \u043f\u043e\u0441\u043b\u0435 ShowTitle, \u043f\u0435\u0440\u0435\u0434 \u043a\u043e\u043c\u043f\u0430\u043d\u044c\u043e\u043d\u043e\u043c
emit_appearance(lines, el, inner, 'field')
# Companion
emit_companion(lines, 'ExtendedTooltip', f'{name}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430', inner, el.get('extendedTooltip'))
@@ -4433,6 +4439,10 @@ def emit_popup(lines, el, name, eid, indent):
if el.get('representation'):
lines.append(f'{inner}<Representation>{el["representation"]}</Representation>')
emit_layout(lines, el, inner)
# Оформление попапа (TitleTextColor / TitleFont) — перед компаньоном
emit_appearance(lines, el, inner, 'field')
emit_companion(lines, 'ExtendedTooltip', f'{name}РасширеннаяПодсказка', inner, el.get('extendedTooltip'))
# Children
@@ -1,4 +1,4 @@
# form-decompile v0.95 — Decompile 1C managed Form.xml to JSON DSL (draft)
# form-decompile v0.96 — Decompile 1C managed Form.xml to JSON DSL (draft)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
param(
@@ -274,6 +274,16 @@ function Get-LangText {
return $map
}
# Get-LangText с восстановлением значимого пробела: PreserveWhitespace=false стрипает
# <v8:content> </v8:content> → "" (неотличимо от суппресса). Платформа НЕ эмитит пустой
# Title/ToolTip, значит исходно был пробел → возвращаем " " (как Get-MLFormattedValue).
function Get-LangTextWS {
param($node)
$t = Get-LangText $node
if ($t -is [string] -and $t -eq '' -and $node.SelectSingleNode("v8:item/v8:content", $ns)) { return ' ' }
return $t
}
# Авто-вывод заголовка из имени — ТОЧНОЕ зеркало Title-FromName из form-compile.
# Нужен, чтобы опускать ru-only заголовки, которые компилятор воспроизведёт сам.
function Title-FromName {
@@ -1074,12 +1084,12 @@ function Add-CommonProps {
$uv = Decompile-XrFlag $node 'UserVisible'; if ($null -ne $uv) { $obj['userVisible'] = $uv }
$titleNode = $node.SelectSingleNode("lf:Title", $ns)
if ($titleNode) {
$t = Get-LangText $titleNode
$t = Get-LangTextWS $titleNode # восстановление значимого пробела (whitespace-заголовок)
if ($null -ne $t) { $obj['title'] = $t }
# formatted у LabelDecoration выводится компилятором из hyperlink — отдельный ключ не нужен (#16 хвост)
}
$ttNode = $node.SelectSingleNode("lf:ToolTip", $ns)
if ($ttNode) { $tt = Get-LangText $ttNode; if ($null -ne $tt) { $obj['tooltip'] = $tt } }
if ($ttNode) { $tt = Get-LangTextWS $ttNode; if ($null -ne $tt) { $obj['tooltip'] = $tt } }
$ttr = Get-Child $node 'ToolTipRepresentation'; if ($ttr) { $obj['tooltipRepresentation'] = $ttr }
# Картинки заголовка/подвала колонки (любой field-тип, эмитятся платформой как column header/footer icon)
$hp = Get-PictureRef $node 'HeaderPicture'; if ($null -ne $hp) { $obj['headerPicture'] = $hp }
+2 -2
View File
@@ -212,7 +212,7 @@ companion-панели с собственным контентом. Оба не
### 4.1e. Оформление элемента (цвета / шрифты / граница)
Прямые свойства оформления элемента. Ключи — англ. camelCase 1:1 с тегами; **принимаются рус. синонимы** (forgiving). Применимо к полям (input/check/radio/labelField/picField/calendar), декорациям (label/picture), кнопкам (button), группам (group/columnGroup) и таблицам (table); порядок тегов в XML — по базовому типу (профиль), компилятор расставляет сам (1С толерантна к порядку оформления внутри элемента).
Прямые свойства оформления элемента. Ключи — англ. camelCase 1:1 с тегами; **принимаются рус. синонимы** (forgiving). Применимо к полям (input/check/radio/labelField/picField/calendar), декорациям (label/picture), кнопкам (button), группам (group/columnGroup), **страницам (page: `backColor`/`titleTextColor`/`titleFont`)**, **попапам (popup: `titleTextColor`/`titleFont`)** и таблицам (table); порядок тегов в XML — по базовому типу (профиль), компилятор расставляет сам (1С толерантна к порядку оформления внутри элемента).
| Ключ | Тег | Рус. синоним |
|------|-----|--------------|
@@ -282,7 +282,7 @@ companion-панели с собственным контентом. Оба не
| `viewMode` / `verticalScrollBar` / `rowInputMode` | `<ViewMode>`/… | свойства таблицы (pass-through) |
> Эти простые скаляры — pass-through (captured/emitted «как есть»), применимы там, где платформа их пишет.
> `defaultItem`/`enableStartDrag`/`fileDragMode`/`skipOnInput` + cell-свойства (`showInHeader`/`showInFooter`/`autoCellHeight`/`footerHorizontalAlign`/`headerHorizontalAlign`/`headerPicture`/`footerPicture`) — общие для любого поля-колонки (input, label, picField, check).
> `defaultItem`/`enableStartDrag`/`fileDragMode`/`skipOnInput` + cell-свойства (`showInHeader`/`showInFooter`/`autoCellHeight`/`footerHorizontalAlign`/`headerHorizontalAlign`/`headerPicture`/`footerPicture`) — общие для любого поля-колонки (input, label, picField, check) и `columnGroup` (картинка заголовка группы колонок).
#### Картинка-ссылка (`headerPicture`/`footerPicture`/`valuesPicture`/`rowsPicture`/Page `picture`)
@@ -23,7 +23,7 @@
{ "button": "Вниз", "command": "Вниз" }
]},
{ "buttonGroup": "ГруппаГлобальныеКоманды", "commandSource": "FormCommandPanelGlobalCommands" },
{ "popup": "ПодменюПечать", "title": "Печать", "picture": "StdPicture.Print", "loadTransparent": false, "representation": "PictureAndText", "children": [
{ "popup": "ПодменюПечать", "title": "Печать", "picture": "StdPicture.Print", "loadTransparent": false, "representation": "PictureAndText", "titleTextColor": "style:ButtonTextColor", "titleFont": "style:ВажнаяНадписьШрифт", "children": [
{ "button": "ПечатьСчёта", "command": "Выполнить" }
]}
]}
@@ -18,7 +18,7 @@
"elements": [
{ "table": "Список", "path": "Список", "columns": [
{ "input": "Наименование", "path": "Список.Наименование" },
{ "columnGroup": "horizontal", "name": "ГруппаСрок", "title": "Срок", "children": [
{ "columnGroup": "horizontal", "name": "ГруппаСрок", "title": "Срок", "headerPicture": "StdPicture.ExecuteTask", "children": [
{ "input": "ДатаНачала", "path": "Список.ДатаНачала" },
{ "input": "ДатаОкончания", "path": "Список.ДатаОкончания" }
]},
+1 -1
View File
@@ -21,7 +21,7 @@
{ "page": "Шаг1", "title": "", "showTitle": false, "picture": "StdPicture.ExecuteTask", "children": [
{ "input": "Параметр1", "path": "Параметр1" }
]},
{ "page": "Шаг2", "title": "Результат", "titleDataPath": "Итог", "tooltip": "Шаг \"Результат\"", "group": "horizontalIfPossible", "picture": { "src": "StdPicture.FilterCriterion", "loadTransparent": true, "transparentPixel": { "x": 2, "y": 4 } }, "children": [
{ "page": "Шаг2", "title": "Результат", "titleDataPath": "Итог", "tooltip": "Шаг \"Результат\"", "group": "horizontalIfPossible", "picture": { "src": "StdPicture.FilterCriterion", "loadTransparent": true, "transparentPixel": { "x": 2, "y": 4 } }, "backColor": "style:FormBackColor", "titleTextColor": "style:FormTextColor", "titleFont": "style:TextFont", "children": [
{ "input": "Итог", "path": "Итог", "readOnly": true }
]}
]},
@@ -57,6 +57,8 @@
<xr:LoadTransparent>false</xr:LoadTransparent>
</Picture>
<Representation>PictureAndText</Representation>
<TitleTextColor>style:ButtonTextColor</TitleTextColor>
<TitleFont ref="style:ВажнаяНадписьШрифт" kind="StyleItem"/>
<ExtendedTooltip name="ПодменюПечатьРасширеннаяПодсказка" id="14"/>
<ChildItems>
<Button name="ПечатьСчёта" id="15">
@@ -52,6 +52,10 @@
</v8:item>
</Title>
<Group>Horizontal</Group>
<HeaderPicture>
<xr:Ref>StdPicture.ExecuteTask</xr:Ref>
<xr:LoadTransparent>false</xr:LoadTransparent>
</HeaderPicture>
<ExtendedTooltip name="ГруппаСрокРасширеннаяПодсказка" id="18"/>
<ChildItems>
<InputField name="ДатаНачала" id="19">
@@ -54,6 +54,9 @@
</Picture>
<Group>HorizontalIfPossible</Group>
<TitleDataPath>Итог</TitleDataPath>
<TitleTextColor>style:FormTextColor</TitleTextColor>
<TitleFont ref="style:TextFont" kind="StyleItem"/>
<BackColor>style:FormBackColor</BackColor>
<ExtendedTooltip name="Шаг2РасширеннаяПодсказка" id="9"/>
<ChildItems>
<InputField name="Итог" id="10">