feat(form-decompile,form-compile): формат динамического заголовка группы/страницы (Format при titleDataPath)

Раундтрип терял <Format> на UsualGroup/Page — формат значения пути к данным заголовка
(<TitleDataPath>): мультиязычный формат вида БЛ=; БИ=* / BF=; BT=* (напр. УчетныеЗаписиЭДО/
УчетнаяЗапись — 4 группы/страницы, 40 строк diff с каскадом структурных v8:item-обёрток).

Корпус (acc+erp 8.3.24): <Format>-блоки — LabelField 1784, InputField 1480 (уже обрабатывались),
UsualGroup 13, Page 10 (пробел). Механизм формата уже был у полей (Add-FormatProps / Emit-MLText);
подключён к группе/странице.

decompile: Add-FormatProps в ветках UsualGroup/Page (захват format/editFormat).
compile (ps1+py): Emit-MLText <Format>/<EditFormat> в Emit-Group/Emit-Page (рядом с titleDataPath).

Верификация: таргет-раундтрип 11 форм с group/page Format → категория закрыта (0 Format LOST;
целевая форма match, было 40→0); остаток — др. категория ListSettings + 1 ring3 (SpreadsheetDocument).
Регресс form-compile 43/43 (ps1+py); 1С-cert кейса groups (группа с Format+TitleDataPath грузится). spec.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-06-12 14:17:26 +03:00
parent cb3dda0d53
commit 3340d48898
6 changed files with 51 additions and 5 deletions
@@ -1,4 +1,4 @@
# form-compile v1.131 — Compile 1C managed form from JSON or object metadata
# form-compile v1.132 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[string]$JsonPath,
@@ -3531,6 +3531,10 @@ function Emit-Group {
# United
if ($el.united -eq $false) { X "$inner<United>false</United>" }
# Формат значения пути к данным заголовка (<Format>; парный к titleDataPath группы)
if ($el.format) { Emit-MLText -tag "Format" -text $el.format -indent $inner }
if ($el.editFormat) { Emit-MLText -tag "EditFormat" -text $el.editFormat -indent $inner }
Emit-CommonFlags -el $el -indent $inner
Emit-Layout -el $el -indent $inner
@@ -4432,6 +4436,9 @@ function Emit-Page {
if ($orientation) { X "$inner<Group>$orientation</Group>" }
}
if ($null -ne $el.showTitle) { X "$inner<ShowTitle>$(if ($el.showTitle){'true'}else{'false'})</ShowTitle>" }
# Формат значения пути к данным заголовка (<Format>; парный к titleDataPath страницы)
if ($el.format) { Emit-MLText -tag "Format" -text $el.format -indent $inner }
if ($el.editFormat) { Emit-MLText -tag "EditFormat" -text $el.editFormat -indent $inner }
Emit-Layout -el $el -indent $inner
# Оформление страницы (BackColor / TitleTextColor / TitleFont) — после ShowTitle, перед компаньоном
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# form-compile v1.131 — Compile 1C managed form from JSON or object metadata
# form-compile v1.132 — Compile 1C managed form from JSON or object metadata
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
import copy
@@ -3625,6 +3625,12 @@ def emit_group(lines, el, name, eid, indent):
if el.get('united') is False:
lines.append(f'{inner}<United>false</United>')
# Формат значения пути к данным заголовка (<Format>; парный к titleDataPath группы)
if el.get('format'):
emit_mltext(lines, inner, 'Format', el['format'])
if el.get('editFormat'):
emit_mltext(lines, inner, 'EditFormat', el['editFormat'])
emit_common_flags(lines, el, inner)
emit_layout(lines, el, inner)
@@ -4162,6 +4168,11 @@ def emit_page(lines, el, name, eid, indent):
lines.append(f'{inner}<Group>{orientation}</Group>')
if el.get('showTitle') is not None:
lines.append(f'{inner}<ShowTitle>{"true" if el["showTitle"] else "false"}</ShowTitle>')
# Формат значения пути к данным заголовка (<Format>; парный к titleDataPath страницы)
if el.get('format'):
emit_mltext(lines, inner, 'Format', el['format'])
if el.get('editFormat'):
emit_mltext(lines, inner, 'EditFormat', el['editFormat'])
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
@@ -1,4 +1,4 @@
# form-decompile v0.105 — Decompile 1C managed Form.xml to JSON DSL (draft)
# form-decompile v0.106 — Decompile 1C managed Form.xml to JSON DSL (draft)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью.
param(
@@ -1612,6 +1612,8 @@ function Decompile-Element {
$crt = $node.SelectSingleNode("lf:CollapsedRepresentationTitle", $ns); if ($crt) { $ct = Get-LangText $crt; if ($null -ne $ct -and $ct -ne '') { $obj['collapsedTitle'] = $ct } }
if ((Get-Child $node 'United') -eq 'false') { $obj['united'] = $false }
if ((Get-Child $node 'Collapsed') -eq 'true') { $obj['collapsed'] = $true }
# Формат значения пути к данным заголовка (<Format>; парный к titleDataPath группы)
Add-FormatProps $obj $node
$kids = Decompile-Children $node
if ($kids) { $obj['children'] = $kids }
}
@@ -1855,6 +1857,8 @@ function Decompile-Element {
# Картинка страницы (иконка вкладки) — конвенция ValuesPicture (дефолт LoadTransparent=false)
$pp = Get-PictureRef $node 'Picture'; if ($null -ne $pp) { $obj['picture'] = $pp }
$st = Get-Child $node 'ShowTitle'; if ($null -ne $st) { $obj['showTitle'] = ($st -eq 'true') } # факт. значение (явный true тоже)
# Формат значения пути к данным заголовка (<Format>; парный к titleDataPath страницы)
Add-FormatProps $obj $node
$kids = Decompile-Children $node
if ($kids) { $obj['children'] = $kids }
}
+1
View File
@@ -364,6 +364,7 @@ companion-панели с собственным контентом. Оба не
| `behavior` | string | Поведение (`<Behavior>`): `usual`, `collapsible`, `popup`. **Отсутствие = Авто** (дефолт, не эмитится). Свёртываемая/всплывающая несут доп. свойства |
| `collapsed` | bool | Свёрнута (у `collapsible`/`popup`) |
| `collapsedTitle` | string/object | Заголовок свёрнутого представления (`<CollapsedRepresentationTitle>`), мультиязычный текст |
| `format` | string/object | Формат значения динамического заголовка (`<Format>`, мультиязычный) — парный к `titleDataPath` (доступен и у `page`). Напр. `{ "ru": "БЛ=; БИ=*", "en": "BF=; BT=*" }` для булева пути |
| `children` | array | Вложенные элементы |
| `showTitle` | bool | Показывать заголовок группы |
| `representation` | string | `none`, `normal`, `weak`, `strong` |
+3 -2
View File
@@ -23,7 +23,7 @@
{ "input": "Поле2", "path": "Поле2", "title": "Поле 2" },
{ "labelField": "Метка", "path": "Поле1", "groupVerticalAlign": "Center" }
]},
{ "group": "vertical", "name": "ГруппаПодвал", "behavior": "collapsible", "collapsed": true, "title": { "ru": "Подвал", "en": "Footer" }, "collapsedTitle": "Развернуть подвал", "showLeftMargin": false, "enableContentChange": false, "verticalSpacing": "None", "displayImportance": "Low", "children": [
{ "group": "vertical", "name": "ГруппаПодвал", "behavior": "collapsible", "collapsed": true, "title": { "ru": "Подвал", "en": "Footer" }, "collapsedTitle": "Развернуть подвал", "titleDataPath": "Изменено", "format": { "ru": "БЛ=; БИ=*", "en": "BF=; BT=*" }, "showLeftMargin": false, "enableContentChange": false, "verticalSpacing": "None", "displayImportance": "Low", "children": [
{ "input": "Поле3", "path": "Поле3", "title": "Поле 3" }
]}
],
@@ -31,7 +31,8 @@
{ "name": "Объект", "type": "DataProcessorObject.СГруппами", "main": true },
{ "name": "Поле1", "type": "string" },
{ "name": "Поле2", "type": "decimal(15,2)" },
{ "name": "Поле3", "type": "date" }
{ "name": "Поле3", "type": "date" },
{ "name": "Изменено", "type": "boolean" }
]
}
}
@@ -91,9 +91,20 @@
<v8:content>Развернуть подвал</v8:content>
</v8:item>
</CollapsedRepresentationTitle>
<Format>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>БЛ=; БИ=*</v8:content>
</v8:item>
<v8:item>
<v8:lang>en</v8:lang>
<v8:content>BF=; BT=*</v8:content>
</v8:item>
</Format>
<EnableContentChange>false</EnableContentChange>
<ShowLeftMargin>false</ShowLeftMargin>
<VerticalSpacing>None</VerticalSpacing>
<TitleDataPath>Изменено</TitleDataPath>
<ExtendedTooltip name="ГруппаПодвалРасширеннаяПодсказка" id="15"/>
<ChildItems>
<InputField name="Поле3" id="16">
@@ -162,5 +173,16 @@
</v8:DateQualifiers>
</Type>
</Attribute>
<Attribute name="Изменено" id="23">
<Title>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Изменено</v8:content>
</v8:item>
</Title>
<Type>
<v8:Type>xs:boolean</v8:Type>
</Type>
</Attribute>
</Attributes>
</Form>